Skip to content

Commit 55a45b2

Browse files
committed
t5620: prepare branched repo for revision tests
Prepare the test infrastructure for upcoming changes that teach 'git backfill' to accept revision arguments and pathspecs. Add test_tick before each commit in the setup loop so that commit dates are deterministic. This enables reliable testing with '--since'. Rename the 'd/e/' directory to 'd/f/' so that the prefix 'd/f' is ambiguous with the files 'd/file.*.txt'. This exercises the subtlety in prefix pathspec matching that will be added in a later commit. Create a branched version of the test repository (src-revs) with: - A 'side' branch merged into main, adding s/file.{1,2}.txt with two versions (4 new blobs, 52 total from main HEAD). - An unmerged 'other' branch adding o/file.{1,2}.txt (2 more blobs, 54 total reachable from --all). This structure makes --all, --first-parent, and --since produce meaningfully different results when used with 'git backfill'. Signed-off-by: Derrick Stolee <stolee@gmail.com>
1 parent fda0239 commit 55a45b2

1 file changed

Lines changed: 50 additions & 2 deletions

File tree

t/t5620-backfill.sh

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ test_expect_success 'setup repo for object creation' '
1515
git init src &&
1616
1717
mkdir -p src/a/b/c &&
18-
mkdir -p src/d/e &&
18+
mkdir -p src/d/f &&
1919
2020
for i in 1 2
2121
do
@@ -26,8 +26,9 @@ test_expect_success 'setup repo for object creation' '
2626
echo "Version $i of file a/b/$n" > src/a/b/file.$n.txt &&
2727
echo "Version $i of file a/b/c/$n" > src/a/b/c/file.$n.txt &&
2828
echo "Version $i of file d/$n" > src/d/file.$n.txt &&
29-
echo "Version $i of file d/e/$n" > src/d/e/file.$n.txt &&
29+
echo "Version $i of file d/f/$n" > src/d/f/file.$n.txt &&
3030
git -C src add . &&
31+
test_tick &&
3132
git -C src commit -m "Iteration $n" || return 1
3233
done
3334
done
@@ -41,6 +42,53 @@ test_expect_success 'setup bare clone for server' '
4142
git -C srv.bare config --local uploadpack.allowanysha1inwant 1
4243
'
4344

45+
# Create a version of the repo with branches for testing revision
46+
# arguments like --all, --first-parent, and --since.
47+
#
48+
# main: 8 commits (linear) + merge of side branch
49+
# 48 original blobs + 4 side blobs = 52 blobs from main HEAD
50+
# side: 2 commits adding s/file.{1,2}.txt (v1, v2), merged into main
51+
# other: 1 commit adding o/file.{1,2}.txt (not merged)
52+
# 54 total blobs reachable from --all
53+
test_expect_success 'setup branched repo for revision tests' '
54+
git clone src src-revs &&
55+
56+
# Side branch from tip of main with unique files
57+
git -C src-revs checkout -b side HEAD &&
58+
mkdir -p src-revs/s &&
59+
echo "Side version 1 of file 1" >src-revs/s/file.1.txt &&
60+
echo "Side version 1 of file 2" >src-revs/s/file.2.txt &&
61+
test_tick &&
62+
git -C src-revs add . &&
63+
git -C src-revs commit -m "Side commit 1" &&
64+
65+
echo "Side version 2 of file 1" >src-revs/s/file.1.txt &&
66+
echo "Side version 2 of file 2" >src-revs/s/file.2.txt &&
67+
test_tick &&
68+
git -C src-revs add . &&
69+
git -C src-revs commit -m "Side commit 2" &&
70+
71+
# Merge side into main
72+
git -C src-revs checkout main &&
73+
test_tick &&
74+
git -C src-revs merge side --no-ff -m "Merge side branch" &&
75+
76+
# Other branch (not merged) for --all testing
77+
git -C src-revs checkout -b other main~1 &&
78+
mkdir -p src-revs/o &&
79+
echo "Other content 1" >src-revs/o/file.1.txt &&
80+
echo "Other content 2" >src-revs/o/file.2.txt &&
81+
test_tick &&
82+
git -C src-revs add . &&
83+
git -C src-revs commit -m "Other commit" &&
84+
85+
git -C src-revs checkout main &&
86+
87+
git clone --bare "file://$(pwd)/src-revs" srv-revs.bare &&
88+
git -C srv-revs.bare config --local uploadpack.allowfilter 1 &&
89+
git -C srv-revs.bare config --local uploadpack.allowanysha1inwant 1
90+
'
91+
4492
# do basic partial clone from "srv.bare"
4593
test_expect_success 'do partial clone 1, backfill gets all objects' '
4694
git clone --no-checkout --filter=blob:none \

0 commit comments

Comments
 (0)