* For each path in paths_to_explore, walk the trees another level * and add any found blobs to the batch (but only if they exist and * haven't been added yet). */
| 299 | * haven't been added yet). |
| 300 | */ |
| 301 | static int walk_path(struct path_walk_context *ctx, |
| 302 | const char *path) |
| 303 | { |
| 304 | struct type_and_oid_list *list; |
| 305 | int ret = 0; |
| 306 | |
| 307 | list = strmap_get(&ctx->paths_to_lists, path); |
| 308 | |
| 309 | if (!list) |
| 310 | BUG("provided path '%s' that had no associated list", path); |
| 311 | |
| 312 | if (!list->oids.nr) |
| 313 | return 0; |
| 314 | |
| 315 | if (ctx->info->prune_all_uninteresting) { |
| 316 | /* |
| 317 | * This is true if all objects were UNINTERESTING |
| 318 | * when added to the list. |
| 319 | */ |
| 320 | if (!list->maybe_interesting) |
| 321 | return 0; |
| 322 | |
| 323 | /* |
| 324 | * But it's still possible that the objects were set |
| 325 | * as UNINTERESTING after being added. Do a quick check. |
| 326 | */ |
| 327 | list->maybe_interesting = 0; |
| 328 | for (size_t i = 0; |
| 329 | !list->maybe_interesting && i < list->oids.nr; |
| 330 | i++) { |
| 331 | if (list->type == OBJ_TREE) { |
| 332 | struct tree *t = lookup_tree(ctx->repo, |
| 333 | &list->oids.oid[i]); |
| 334 | if (t && !(t->object.flags & UNINTERESTING)) |
| 335 | list->maybe_interesting = 1; |
| 336 | } else if (list->type == OBJ_BLOB) { |
| 337 | struct blob *b = lookup_blob(ctx->repo, |
| 338 | &list->oids.oid[i]); |
| 339 | if (b && !(b->object.flags & UNINTERESTING)) |
| 340 | list->maybe_interesting = 1; |
| 341 | } else { |
| 342 | /* Tags are always interesting if visited. */ |
| 343 | list->maybe_interesting = 1; |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | /* We have confirmed that all objects are UNINTERESTING. */ |
| 348 | if (!list->maybe_interesting) |
| 349 | return 0; |
| 350 | } |
| 351 | |
| 352 | if (list->type == OBJ_BLOB && |
| 353 | ctx->revs->prune_data.nr && |
| 354 | !path_is_for_direct_objects(path) && |
| 355 | !match_pathspec(ctx->repo->index, &ctx->revs->prune_data, |
| 356 | path, strlen(path), 0, |
| 357 | NULL, 0)) |
| 358 | return 0; |
no test coverage detected