t6022: New test checking for unnecessary updates of files in D/F conflicts
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Feb 28, 2011 at 18:08 UTC
eeba0d1760d6922e7d6ee838b8684e87a6c0c273
1 file changed
+33
t/t6022-merge-rename.sh
+33
@@ -737,4 +737,37 @@ test_expect_failure 'avoid unnecessary update, normal rename' '
737
test_cmp expect actual # "rename" should have stayed intact
738
'
739
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
+
773
test_done