t6022: Add testcase for merging a renamed file with a simple change
This is a testcase that was broken by b2c8c0a (merge-recursive: When we detect we can skip an update, actually skip it 2011-02-28) and fixed by 6db4105 (Revert "Merge branch 'en/merge-recursive'" 2011-05-19). Include this testcase to ensure we don't regress it again. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Aug 11, 2011 at 23:19 UTC
7dd9c304be5f9299d7b4b8ddb59072f774ecf081
1 file changed
+27
t/t6022-merge-rename.sh
+27
@@ -673,4 +673,31 @@ test_expect_failure 'avoid unnecessary update, with D/F conflict' '
673
test_cmp expect actual # "df" should have stayed intact
674
'
675
676
+test_expect_success 'setup merge of rename + small change' '
677
+ git reset --hard &&
678
+ git checkout --orphan rename-plus-small-change &&
679
+ git rm -rf . &&
680
+ git clean -fdqx &&
681
+
682
+ echo ORIGINAL >file &&
683
+ git add file &&
684
+
685
+ test_tick &&
686
+ git commit -m Initial &&
687
+ git checkout -b rename_branch &&
688
+ git mv file renamed_file &&
689
+ git commit -m Rename &&
690
+ git checkout rename-plus-small-change &&
691
+ echo NEW-VERSION >file &&
692
+ git commit -a -m Reformat
693
+'
694
+
695
+test_expect_success 'merge rename + small change' '
696
+ git merge rename_branch &&
697
+
698
+ test 1 -eq $(git ls-files -s | wc -l) &&
699
+ test 0 -eq $(git ls-files -o | wc -l) &&
700
+ test $(git rev-parse HEAD:renamed_file) = $(git rev-parse HEAD~1:file)
701
+'
702
+
703
test_done