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

Function should_include_pack

midx-write.c:133–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133static int should_include_pack(const struct write_midx_context *ctx,
134 const char *file_name)
135{
136 /*
137 * Note that at most one of ctx->m and ctx->to_include are set,
138 * so we are testing midx_contains_pack() and
139 * string_list_has_string() independently (guarded by the
140 * appropriate NULL checks).
141 *
142 * We could support passing to_include while reusing an existing
143 * MIDX, but don't currently since the reuse process drags
144 * forward all packs from an existing MIDX (without checking
145 * whether or not they appear in the to_include list).
146 *
147 * If we added support for that, these next two conditional
148 * should be performed independently (likely checking
149 * to_include before the existing MIDX).
150 */
151 if (ctx->m && midx_contains_pack(ctx->m, file_name))
152 return 0;
153 else if (ctx->base_midx && midx_contains_pack(ctx->base_midx,
154 file_name))
155 return 0;
156 else if (ctx->to_include &&
157 !string_list_has_string(ctx->to_include, file_name))
158 return 0;
159 return 1;
160}
161
162static void add_pack_to_midx(const char *full_path, size_t full_path_len,
163 const char *file_name, void *data)

Callers 1

add_pack_to_midxFunction · 0.85

Calls 2

midx_contains_packFunction · 0.85
string_list_has_stringFunction · 0.85

Tested by

no test coverage detected