Skip to content

Commit f59ba1c

Browse files
newrengitster
authored andcommitted
t6022: New test checking for unnecessary updates of renamed+modified files
Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9f6cea9 commit f59ba1c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

t/t6022-merge-rename.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,4 +707,34 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
707707
! test -f original
708708
'
709709

710+
test_expect_success 'setup avoid unnecessary update, normal rename' '
711+
git reset --hard &&
712+
git checkout --orphan avoid-unnecessary-update-1 &&
713+
git rm -rf . &&
714+
git clean -fdqx &&
715+
716+
printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" >original &&
717+
git add -A &&
718+
git commit -m "Common commmit" &&
719+
720+
git mv original rename &&
721+
echo 11 >>rename &&
722+
git add -u &&
723+
git commit -m "Renamed and modified" &&
724+
725+
git checkout -b merge-branch-1 HEAD~1 &&
726+
echo "random content" >random-file &&
727+
git add -A &&
728+
git commit -m "Random, unrelated changes"
729+
'
730+
731+
test_expect_failure 'avoid unnecessary update, normal rename' '
732+
git checkout -q avoid-unnecessary-update-1^0 &&
733+
test-chmtime =1000000000 rename &&
734+
test-chmtime -v +0 rename >expect &&
735+
git merge merge-branch-1 &&
736+
test-chmtime -v +0 rename >actual &&
737+
test_cmp expect actual # "rename" should have stayed intact
738+
'
739+
710740
test_done

0 commit comments

Comments
 (0)