| 812 | } |
| 813 | |
| 814 | static char *keep_pack(const char *curr_index_name) |
| 815 | { |
| 816 | static const char *keep_msg = "fast-import"; |
| 817 | struct strbuf name = STRBUF_INIT; |
| 818 | int keep_fd; |
| 819 | |
| 820 | odb_pack_name(pack_data->repo, &name, pack_data->hash, "keep"); |
| 821 | keep_fd = safe_create_file_with_leading_directories(pack_data->repo, |
| 822 | name.buf); |
| 823 | if (keep_fd < 0) |
| 824 | die_errno(_("cannot create keep file")); |
| 825 | write_or_die(keep_fd, keep_msg, strlen(keep_msg)); |
| 826 | if (close(keep_fd)) |
| 827 | die_errno(_("failed to write keep file")); |
| 828 | |
| 829 | odb_pack_name(pack_data->repo, &name, pack_data->hash, "pack"); |
| 830 | if (finalize_object_file(pack_data->repo, pack_data->pack_name, name.buf)) |
| 831 | die(_("cannot store pack file")); |
| 832 | |
| 833 | odb_pack_name(pack_data->repo, &name, pack_data->hash, "idx"); |
| 834 | if (finalize_object_file(pack_data->repo, curr_index_name, name.buf)) |
| 835 | die(_("cannot store index file")); |
| 836 | free((void *)curr_index_name); |
| 837 | return strbuf_detach(&name, NULL); |
| 838 | } |
| 839 | |
| 840 | static void unkeep_all_packs(void) |
| 841 | { |
no test coverage detected