git branch red &&
git branch blue &&
git branch yellow &&
+git branch change &&
+git branch change+rename &&
sed -e "/^g /s/.*/g : master changes a line/" <A >A+ &&
mv A+ A &&
git update-index --add --remove A C M N &&
git commit -m "blue renames A->C, M->N" &&
+git checkout change &&
+sed -e "/^g /s/.*/g : changed line/" <A >A+ &&
+mv A+ A &&
+git commit -q -a -m "changed" &&
+
+git checkout change+rename &&
+sed -e "/^g /s/.*/g : changed line/" <A >B &&
+rm A &&
+git update-index --add B &&
+git commit -q -a -m "changed and renamed" &&
+
git checkout master'
test_expect_success 'pull renaming branch into unrenaming one' \
echo "BAD: should have complained"
return 1
}
- diff M M.saved || {
+ test_cmp M M.saved || {
echo "BAD: should have left M intact"
return 1
}
echo "BAD: should have complained"
return 1
}
- diff M M.saved || {
+ test_cmp M M.saved || {
echo "BAD: should have left M intact"
return 1
}
git reset --hard anchor
'
+test_expect_success 'merge of identical changes in a renamed file' '
+ rm -f A M N
+ git reset --hard &&
+ git checkout change+rename &&
+ GIT_MERGE_VERBOSITY=3 git merge change | grep "^Skipped B" &&
+ git reset --hard HEAD^ &&
+ git checkout change &&
+ GIT_MERGE_VERBOSITY=3 git merge change+rename | grep "^Skipped B"
+'
+
test_done