*/
struct prio_queue path_stack;
struct strset path_stack_pushed;
+
+ unsigned exact_pathspecs:1;
};
static int compare_by_type(const void *one, const void *two, void *cb_data)
match != MATCHED)
continue;
}
- if (ctx->revs->prune_data.nr) {
+ if (ctx->revs->prune_data.nr && ctx->exact_pathspecs) {
struct pathspec *pd = &ctx->revs->prune_data;
bool found = false;
int did_strip_suffix = strbuf_strip_suffix(&path, "/");
return 0;
}
+ if (list->type == OBJ_BLOB &&
+ ctx->revs->prune_data.nr &&
+ !match_pathspec(ctx->repo->index, &ctx->revs->prune_data,
+ path, strlen(path), 0,
+ NULL, 0))
+ return 0;
+
/* Evaluate function pointer on this data, if requested. */
if ((list->type == OBJ_TREE && ctx->info->trees) ||
(list->type == OBJ_BLOB && ctx->info->blobs) ||
info->revs->tag_objects = 1;
if (ctx.revs->prune_data.nr) {
- /*
- * Only exact prefix pathspecs are currently supported.
- * Clear any wildcard or magic pathspecs to avoid
- * incorrect prefix matching.
- */
- if (ctx.revs->prune_data.has_wildcard ||
- ctx.revs->prune_data.magic)
- clear_pathspec(&ctx.revs->prune_data);
+ if (!ctx.revs->prune_data.has_wildcard &&
+ !ctx.revs->prune_data.magic)
+ ctx.exact_pathspecs = 1;
}
/* Insert a single list for the root tree into the paths. */
git -C backfill-path rev-list --quiet --objects --missing=print HEAD >missing &&
test_line_count = 48 missing &&
- # TODO: The wildcard pathspec should limit downloaded blobs,
- # but currently all blobs are downloaded.
- git -C backfill-path backfill HEAD -- "d/file.*.txt" &&
+ git -C backfill-path backfill HEAD -- "d/file.*.txt" 2>err &&
+ test_must_be_empty err &&
git -C backfill-path rev-list --quiet --objects --missing=print HEAD >missing &&
- test_line_count = 0 missing
+ test_line_count = 40 missing
'
test_expect_success 'backfill with --all' '