filter-branch: Test renaming directories in a tree-filter
[git/platforms.git] / t / t6004-rev-list-path-optim.sh
blob5dabf1c5e354c28cc593bd0ea8e4b0d5f0d56d67
1 #!/bin/sh
3 test_description='git rev-list trivial path optimization test'
5 . ./test-lib.sh
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)
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 &&
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"
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
51 test_done