3 test_description
='git rev-list trivial path optimization test'
7 test_expect_success setup
'
10 git commit -m "Initial commit" a &&
11 initial=$(git rev-parse --verify HEAD)
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
20 test_expect_success
'further setup' '
21 git checkout -b side &&
24 git commit -m "Side makes an irrelevant commit" &&
25 echo "More Irrelevancy" >c &&
27 git commit -m "Side makes another irrelevant commit" &&
30 git commit -m "Side touches a" &&
31 side=$(git rev-parse --verify HEAD) &&
32 echo "Yet more Irrelevancy" >c &&
34 git commit -m "Side makes yet another irrelevant commit" &&
35 git checkout master &&
38 git commit -m "Master touches b" &&
42 git commit -m "Master touches b again"
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