t6022: New test checking for unnecessary updates of renamed+modified files
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
f59ba1cea02b3bed1025fd22f8601923fc81b6af
1 file changed
+30
t/t6022-merge-rename.sh
+30
@@ -707,4 +707,34 @@ test_expect_success 'check handling of differently renamed file with D/F conflic
707
! test -f original
708
'
709
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
+
740
test_done