MCPcopy Index your code
hub / github.com/git/git / index_pack_lockfile

Function index_pack_lockfile

pack-write.c:472–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470}
471
472char *index_pack_lockfile(struct repository *r, int ip_out, int *is_well_formed)
473{
474 char packname[GIT_MAX_HEXSZ + 6];
475 const int len = r->hash_algo->hexsz + 6;
476
477 /*
478 * The first thing we expect from index-pack's output
479 * is "pack\t%40s\n" or "keep\t%40s\n" (46 bytes) where
480 * %40s is the newly created pack SHA1 name. In the "keep"
481 * case, we need it to remove the corresponding .keep file
482 * later on. If we don't get that then tough luck with it.
483 */
484 if (read_in_full(ip_out, packname, len) == len && packname[len-1] == '\n') {
485 const char *name;
486
487 if (is_well_formed)
488 *is_well_formed = 1;
489 packname[len-1] = 0;
490 if (skip_prefix(packname, "keep\t", &name))
491 return xstrfmt("%s/pack/pack-%s.keep",
492 repo_get_object_directory(r), name);
493 return NULL;
494 }
495 if (is_well_formed)
496 *is_well_formed = 0;
497 return NULL;
498}
499
500/*
501 * The per-object header is a pretty dense thing, which is

Callers 2

get_packFunction · 0.85
unpackFunction · 0.85

Calls 3

read_in_fullFunction · 0.85
xstrfmtFunction · 0.85

Tested by

no test coverage detected