t6022: New tests checking for unnecessary updates of files
This testcase was part of en/merge-recursive that was reverted in 6db4105
(Revert "Merge branch 'en/merge-recursive'" 2011-05-19). While the other
changes in that series caused unfortunate breakage, this testcase is still
useful; reinstate it.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
5b5261baab
commit
f1a0f457b3
@ -610,4 +610,67 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
|
|||||||
! test -f original
|
! test -f original
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'setup avoid unnecessary update, normal rename' '
|
||||||
|
git reset --hard &&
|
||||||
|
git checkout --orphan avoid-unnecessary-update-1 &&
|
||||||
|
git rm -rf . &&
|
||||||
|
git clean -fdqx &&
|
||||||
|
|
||||||
|
printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" >original &&
|
||||||
|
git add -A &&
|
||||||
|
git commit -m "Common commmit" &&
|
||||||
|
|
||||||
|
git mv original rename &&
|
||||||
|
echo 11 >>rename &&
|
||||||
|
git add -u &&
|
||||||
|
git commit -m "Renamed and modified" &&
|
||||||
|
|
||||||
|
git checkout -b merge-branch-1 HEAD~1 &&
|
||||||
|
echo "random content" >random-file &&
|
||||||
|
git add -A &&
|
||||||
|
git commit -m "Random, unrelated changes"
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure 'avoid unnecessary update, normal rename' '
|
||||||
|
git checkout -q avoid-unnecessary-update-1^0 &&
|
||||||
|
test-chmtime =1000000000 rename &&
|
||||||
|
test-chmtime -v +0 rename >expect &&
|
||||||
|
git merge merge-branch-1 &&
|
||||||
|
test-chmtime -v +0 rename >actual &&
|
||||||
|
test_cmp expect actual # "rename" should have stayed intact
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'setup to test avoiding unnecessary update, with D/F conflict' '
|
||||||
|
git reset --hard &&
|
||||||
|
git checkout --orphan avoid-unnecessary-update-2 &&
|
||||||
|
git rm -rf . &&
|
||||||
|
git clean -fdqx &&
|
||||||
|
|
||||||
|
mkdir df &&
|
||||||
|
printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" >df/file &&
|
||||||
|
git add -A &&
|
||||||
|
git commit -m "Common commmit" &&
|
||||||
|
|
||||||
|
git mv df/file temp &&
|
||||||
|
rm -rf df &&
|
||||||
|
git mv temp df &&
|
||||||
|
echo 11 >>df &&
|
||||||
|
git add -u &&
|
||||||
|
git commit -m "Renamed and modified" &&
|
||||||
|
|
||||||
|
git checkout -b merge-branch-2 HEAD~1 &&
|
||||||
|
>unrelated-change &&
|
||||||
|
git add unrelated-change &&
|
||||||
|
git commit -m "Only unrelated changes"
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure 'avoid unnecessary update, with D/F conflict' '
|
||||||
|
git checkout -q avoid-unnecessary-update-2^0 &&
|
||||||
|
test-chmtime =1000000000 df &&
|
||||||
|
test-chmtime -v +0 df >expect &&
|
||||||
|
git merge merge-branch-2 &&
|
||||||
|
test-chmtime -v +0 df >actual &&
|
||||||
|
test_cmp expect actual # "df" should have stayed intact
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user