MCPcopy Create free account
hub / github.com/git/git / keep_pack

Function keep_pack

builtin/fast-import.c:814–838  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

812}
813
814static 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
840static void unkeep_all_packs(void)
841{

Callers 1

end_packfileFunction · 0.85

Calls 7

odb_pack_nameFunction · 0.85
die_errnoFunction · 0.85
write_or_dieFunction · 0.85
finalize_object_fileFunction · 0.85
strbuf_detachFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected