aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDerrick Stolee <stolee@gmail.com>2026-03-26 15:14:52 +0000
committerJunio C Hamano <gitster@pobox.com>2026-03-26 09:38:06 -0700
commit7be182045a6a113b118982fc81296d5b9746779e (patch)
treed68789bd8ab8f3908822a197a13bb52eab24521f /t
parent302aff09223f81d9bd0bb496a3aea9f279d1991f (diff)
downloadgit-7be182045a6a113b118982fc81296d5b9746779e.tar.xz
backfill: work with prefix pathspecs
The previous change allowed specifying revision arguments over the 'git backfill' command-line. This created the opportunity for restricting the initial commit set by filtering the revision walk through a pathspec. Other than filtering the commit set (and thereby the root trees), this did not restrict the path-walk implementation of 'git backfill' and did not restrict the blobs that were downloaded to only those matching the pathspec. Update the path-walk API to accept certain kinds of pathspecs and to silently ignore anything too complex, for now. We will update this in the next change to properly restrict to even complex pathspecs. The current behavior focuses on pathspecs that match paths exactly. This includes exact filenames, including directory names as prefixes. Pathspecs containing wildcards or magic are cleared so the path walk downloads all blobs, as before. The reason for this restriction is to allow for a faster execution by pruning the path walk to only trees that could contribute towards one of those paths as a parent directory. The test directory 'd/f/' (next to 'd/file*.txt') was prepared in a previous commit to exercise the subtlety in prefix matching. Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5620-backfill.sh16
1 files changed, 6 insertions, 10 deletions
diff --git a/t/t5620-backfill.sh b/t/t5620-backfill.sh
index db66d8b614..52f6484ca1 100755
--- a/t/t5620-backfill.sh
+++ b/t/t5620-backfill.sh
@@ -273,13 +273,11 @@ test_expect_success 'backfill with prefix pathspec' '
git -C backfill-path rev-list --quiet --objects --missing=print HEAD >missing &&
test_line_count = 48 missing &&
- # TODO: The pathspec should limit the downloaded blobs to
- # only those matching the prefix "d/f", but currently all
- # blobs are downloaded.
- git -C backfill-path backfill HEAD -- d/f &&
+ git -C backfill-path backfill HEAD -- d/f 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 multiple pathspecs' '
@@ -292,13 +290,11 @@ test_expect_success 'backfill with multiple pathspecs' '
git -C backfill-path rev-list --quiet --objects --missing=print HEAD >missing &&
test_line_count = 48 missing &&
- # TODO: The pathspecs should limit the downloaded blobs to
- # only those matching "d/f" or "a", but currently all blobs
- # are downloaded.
- git -C backfill-path backfill HEAD -- d/f a &&
+ git -C backfill-path backfill HEAD -- d/f a 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 = 16 missing
'
test_expect_success 'backfill with wildcard pathspec' '