2006-07-25 03:23:03 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-07-03 09:52:14 +04:00
|
|
|
test_description='git rev-list trivial path optimization test'
|
2006-07-25 03:23:03 +04:00
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
test_expect_success setup '
|
|
|
|
echo Hello > a &&
|
|
|
|
git add a &&
|
2007-03-23 09:22:07 +03:00
|
|
|
git commit -m "Initial commit" a &&
|
|
|
|
initial=$(git rev-parse --verify HEAD)
|
2006-07-25 03:23:03 +04:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success path-optimization '
|
2007-07-03 09:52:14 +04:00
|
|
|
commit=$(echo "Unchanged tree" | git commit-tree "HEAD^{tree}" -p HEAD) &&
|
|
|
|
test $(git rev-list $commit | wc -l) = 2 &&
|
|
|
|
test $(git rev-list $commit -- . | wc -l) = 1
|
2006-07-25 03:23:03 +04:00
|
|
|
'
|
|
|
|
|
2007-03-23 09:22:07 +03:00
|
|
|
test_expect_success 'further setup' '
|
|
|
|
git checkout -b side &&
|
|
|
|
echo Irrelevant >c &&
|
|
|
|
git add c &&
|
|
|
|
git commit -m "Side makes an irrelevant commit" &&
|
|
|
|
echo "More Irrelevancy" >c &&
|
|
|
|
git add c &&
|
|
|
|
git commit -m "Side makes another irrelevant commit" &&
|
|
|
|
echo Bye >a &&
|
|
|
|
git add a &&
|
|
|
|
git commit -m "Side touches a" &&
|
|
|
|
side=$(git rev-parse --verify HEAD) &&
|
|
|
|
echo "Yet more Irrelevancy" >c &&
|
|
|
|
git add c &&
|
|
|
|
git commit -m "Side makes yet another irrelevant commit" &&
|
|
|
|
git checkout master &&
|
|
|
|
echo Another >b &&
|
|
|
|
git add b &&
|
|
|
|
git commit -m "Master touches b" &&
|
|
|
|
git merge side &&
|
|
|
|
echo Touched >b &&
|
|
|
|
git add b &&
|
|
|
|
git commit -m "Master touches b again"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'path optimization 2' '
|
|
|
|
( echo "$side"; echo "$initial" ) >expected &&
|
|
|
|
git rev-list HEAD -- a >actual &&
|
2008-03-13 00:36:36 +03:00
|
|
|
test_cmp expected actual
|
2007-03-23 09:22:07 +03:00
|
|
|
'
|
|
|
|
|
2006-07-25 03:23:03 +04:00
|
|
|
test_done
|