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

Function pack_geometry_init

repack-geometry.c:29–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29void pack_geometry_init(struct pack_geometry *geometry,
30 struct existing_packs *existing,
31 const struct pack_objects_args *args)
32{
33 struct packed_git *p;
34 struct strbuf buf = STRBUF_INIT;
35 struct multi_pack_index *m = get_multi_pack_index(existing->source);
36
37 repo_for_each_pack(existing->repo, p) {
38 if (geometry->midx_layer_threshold_set && m &&
39 p->multi_pack_index) {
40 /*
41 * When writing MIDX layers incrementally,
42 * ignore packs unless they are in the most
43 * recent MIDX layer *and* there are at least
44 * 'midx_layer_threshold' packs in that layer.
45 *
46 * Otherwise 'p' is either in an older layer, or
47 * the youngest layer does not have enough packs
48 * to consider its packs as candidates for
49 * repacking. In either of those cases we want
50 * to ignore the pack.
51 */
52 if (m->num_packs < geometry->midx_layer_threshold ||
53 !midx_layer_contains_pack(m, pack_basename(p)))
54 continue;
55 }
56
57 if (args->local && !p->pack_local)
58 /*
59 * When asked to only repack local packfiles we skip
60 * over any packfiles that are borrowed from alternate
61 * object directories.
62 */
63 continue;
64
65 if (!args->pack_kept_objects) {
66 /*
67 * Any pack that has its pack_keep bit set will
68 * appear in existing->kept_packs below, but
69 * this saves us from doing a more expensive
70 * check.
71 */
72 if (p->pack_keep)
73 continue;
74
75 /*
76 * The pack may be kept via the --keep-pack
77 * option; check 'existing->kept_packs' to
78 * determine whether to ignore it.
79 */
80 strbuf_reset(&buf);
81 strbuf_addstr(&buf, pack_basename(p));
82 strbuf_strip_suffix(&buf, ".pack");
83
84 if (string_list_has_string(&existing->kept_packs, buf.buf))
85 continue;
86 }

Callers 3

cmd_repackFunction · 0.85

Calls 7

get_multi_pack_indexFunction · 0.85
midx_layer_contains_packFunction · 0.85
pack_basenameFunction · 0.85
strbuf_addstrFunction · 0.85
strbuf_strip_suffixFunction · 0.85
string_list_has_stringFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected