t6004: add a bit more path optimization test.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Mar 22, 2007 at 23:22 UTC
bab36bf57d7a565e0077e1f5d2e3a10afa319ecc
1 file changed
+33
-1
t/t6004-rev-list-path-optim.sh
+33
-1
@@ -7,7 +7,8 @@ test_description='git-rev-list trivial path optimization test'
7
test_expect_success setup '
8
echo Hello > a &&
9
git add a &&
10
-git commit -m "Initial commit" a
10
+git commit -m "Initial commit" a &&
11
+initial=$(git rev-parse --verify HEAD)
12
'
13
14
test_expect_success path-optimization '
@@ -16,4 +17,35 @@ test_expect_success path-optimization '
17
test $(git-rev-list $commit -- . | wc -l) = 1
18
'
19
20
+test_expect_success 'further setup' '
21
+ git checkout -b side &&
22
+ echo Irrelevant >c &&
23
+ git add c &&
24
+ git commit -m "Side makes an irrelevant commit" &&
25
+ echo "More Irrelevancy" >c &&
26
+ git add c &&
27
+ git commit -m "Side makes another irrelevant commit" &&
28
+ echo Bye >a &&
29
+ git add a &&
30
+ git commit -m "Side touches a" &&
31
+ side=$(git rev-parse --verify HEAD) &&
32
+ echo "Yet more Irrelevancy" >c &&
33
+ git add c &&
34
+ git commit -m "Side makes yet another irrelevant commit" &&
35
+ git checkout master &&
36
+ echo Another >b &&
37
+ git add b &&
38
+ git commit -m "Master touches b" &&
39
+ git merge side &&
40
+ echo Touched >b &&
41
+ git add b &&
42
+ git commit -m "Master touches b again"
43
+'
44
+
45
+test_expect_success 'path optimization 2' '
46
+ ( echo "$side"; echo "$initial" ) >expected &&
47
+ git rev-list HEAD -- a >actual &&
48
+ diff -u expected actual
49
+'
50
+
51
test_done