Skip to content

Commit f577b92

Browse files
committed
t6004: add pathspec globbing test for log family
Earlier e10cb0f (tree_entry_interesting(): support wildcard matching, 2010-12-15) and b3d4b34 (tree_entry_interesting(): optimize wildcard matching when base is matched, 2010-12-15) added tests for globbing support for diff-tree plumbing. This is a follow-up to update the test for revision traversal and path pruning machinery for the same topic. Signed-off-by: Junio C Hamano <[email protected]>
1 parent b31f688 commit f577b92

File tree

1 file changed

+57
-12
lines changed

1 file changed

+57
-12
lines changed

t/t6004-rev-list-path-optim.sh

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,96 @@
11
#!/bin/sh
22

3-
test_description='git rev-list trivial path optimization test'
3+
test_description='git rev-list trivial path optimization test
4+
5+
d/z1
6+
b0 b1
7+
o------------------------*----o master
8+
/ /
9+
o---------o----o----o----o side
10+
a0 c0 c1 a1 c2
11+
d/f0 d/f1
12+
d/z0
13+
14+
'
415

516
. ./test-lib.sh
617

718
test_expect_success setup '
8-
echo Hello > a &&
9-
git add a &&
10-
git commit -m "Initial commit" a &&
11-
initial=$(git rev-parse --verify HEAD)
19+
echo Hello >a &&
20+
mkdir d &&
21+
echo World >d/f &&
22+
echo World >d/z &&
23+
git add a d &&
24+
test_tick &&
25+
git commit -m "Initial commit" &&
26+
git rev-parse --verify HEAD &&
27+
git tag initial
1228
'
1329

1430
test_expect_success path-optimization '
15-
commit=$(echo "Unchanged tree" | git commit-tree "HEAD^{tree}" -p HEAD) &&
16-
test $(git rev-list $commit | wc -l) = 2 &&
17-
test $(git rev-list $commit -- . | wc -l) = 1
31+
test_tick &&
32+
commit=$(echo "Unchanged tree" | git commit-tree "HEAD^{tree}" -p HEAD) &&
33+
test $(git rev-list $commit | wc -l) = 2 &&
34+
test $(git rev-list $commit -- . | wc -l) = 1
1835
'
1936

2037
test_expect_success 'further setup' '
2138
git checkout -b side &&
2239
echo Irrelevant >c &&
23-
git add c &&
40+
echo Irrelevant >d/f &&
41+
git add c d/f &&
42+
test_tick &&
2443
git commit -m "Side makes an irrelevant commit" &&
44+
git tag side_c0 &&
2545
echo "More Irrelevancy" >c &&
2646
git add c &&
47+
test_tick &&
2748
git commit -m "Side makes another irrelevant commit" &&
2849
echo Bye >a &&
2950
git add a &&
51+
test_tick &&
3052
git commit -m "Side touches a" &&
31-
side=$(git rev-parse --verify HEAD) &&
53+
git tag side_a1 &&
3254
echo "Yet more Irrelevancy" >c &&
3355
git add c &&
56+
test_tick &&
3457
git commit -m "Side makes yet another irrelevant commit" &&
3558
git checkout master &&
3659
echo Another >b &&
37-
git add b &&
60+
echo Munged >d/z &&
61+
git add b d/z &&
62+
test_tick &&
3863
git commit -m "Master touches b" &&
64+
git tag master_b0 &&
3965
git merge side &&
4066
echo Touched >b &&
4167
git add b &&
68+
test_tick &&
4269
git commit -m "Master touches b again"
4370
'
4471

4572
test_expect_success 'path optimization 2' '
46-
( echo "$side"; echo "$initial" ) >expected &&
73+
git rev-parse side_a1 initial >expected &&
4774
git rev-list HEAD -- a >actual &&
4875
test_cmp expected actual
4976
'
5077

78+
test_expect_success 'pathspec with leading path' '
79+
git rev-parse master^ master_b0 side_c0 initial >expected &&
80+
git rev-list HEAD -- d >actual &&
81+
test_cmp expected actual
82+
'
83+
84+
test_expect_success 'pathspec with glob (1)' '
85+
git rev-parse master^ master_b0 side_c0 initial >expected &&
86+
git rev-list HEAD -- "d/*" >actual &&
87+
test_cmp expected actual
88+
'
89+
90+
test_expect_success 'pathspec with glob (2)' '
91+
git rev-parse side_c0 initial >expected &&
92+
git rev-list HEAD -- "d/[a-m]*" >actual &&
93+
test_cmp expected actual
94+
'
95+
5196
test_done

0 commit comments

Comments
 (0)