| 131 | } |
| 132 | |
| 133 | static 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 | |
| 162 | static void add_pack_to_midx(const char *full_path, size_t full_path_len, |
| 163 | const char *file_name, void *data) |
no test coverage detected