Skip to content

Commit eeba0d1

Browse files
newrengitster
authored andcommitted
t6022: New test checking for unnecessary updates of files in D/F conflicts
Reported-by: Stephen Rothwell <[email protected]> Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f59ba1c commit eeba0d1

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

t/t6022-merge-rename.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,4 +737,37 @@ test_expect_failure 'avoid unnecessary update, normal rename' '
737737
test_cmp expect actual # "rename" should have stayed intact
738738
'
739739

740+
test_expect_success 'setup to test avoiding unnecessary update, with D/F conflict' '
741+
git reset --hard &&
742+
git checkout --orphan avoid-unnecessary-update-2 &&
743+
git rm -rf . &&
744+
git clean -fdqx &&
745+
746+
mkdir df &&
747+
printf "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n" >df/file &&
748+
git add -A &&
749+
git commit -m "Common commmit" &&
750+
751+
git mv df/file temp &&
752+
rm -rf df &&
753+
git mv temp df &&
754+
echo 11 >>df &&
755+
git add -u &&
756+
git commit -m "Renamed and modified" &&
757+
758+
git checkout -b merge-branch-2 HEAD~1 &&
759+
>unrelated-change &&
760+
git add unrelated-change &&
761+
git commit -m "Only unrelated changes"
762+
'
763+
764+
test_expect_failure 'avoid unnecessary update, with D/F conflict' '
765+
git checkout -q avoid-unnecessary-update-2^0 &&
766+
test-chmtime =1000000000 df &&
767+
test-chmtime -v +0 df >expect &&
768+
git merge merge-branch-2 &&
769+
test-chmtime -v +0 df >actual &&
770+
test_cmp expect actual # "df" should have stayed intact
771+
'
772+
740773
test_done

0 commit comments

Comments
 (0)