]> rtime.felk.cvut.cz Git - git.git/blob - t/t6004-rev-list-path-optim.sh
Update draft release notes to 1.7.2
[git.git] / t / t6004-rev-list-path-optim.sh
1 #!/bin/sh
2
3 test_description='git rev-list trivial path optimization test'
4
5 . ./test-lib.sh
6
7 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)
12 '
13
14 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
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         test_cmp expected actual
49 '
50
51 test_done