Merge branch 'lt/tree-2'
[git.git] / t / t6022-merge-rename.sh
index 153b9e4..5ac2564 100755 (executable)
@@ -3,6 +3,12 @@
 test_description='Merge-recursive merging renames'
 . ./test-lib.sh
 
+if test "$no_python"; then
+       echo "Skipping: no python => no recursive merge"
+       test_done
+       exit 0
+fi
+
 test_expect_success setup \
 '
 cat >A <<\EOF &&
@@ -105,6 +111,7 @@ test_expect_success 'pull renaming branch into unrenaming one' \
 
 test_expect_success 'pull renaming branch into another renaming one' \
 '
+       rm -f B
        git reset --hard
        git checkout red
        git pull . white && {
@@ -161,4 +168,41 @@ test_expect_success 'pull unrenaming branch into renaming one' \
        }
 '
 
+test_expect_success 'pull conflicting renames' \
+'
+       git reset --hard
+       git show-branch
+       git pull . blue && {
+               echo "BAD: should have conflicted"
+               exit 1
+       }
+       test "$(git ls-files -u A | wc -l)" -eq 1 || {
+               echo "BAD: should have left a stage"
+               exit 1  
+       }
+       test "$(git ls-files -u B | wc -l)" -eq 1 || {
+               echo "BAD: should have left a stage"
+               exit 1  
+       }
+       test "$(git ls-files -u C | wc -l)" -eq 1 || {
+               echo "BAD: should have left a stage"
+               exit 1  
+       }
+       test "$(git ls-files -s N | wc -l)" -eq 1 || {
+               echo "BAD: should have merged N"
+               exit 1  
+       }
+       sed -ne "/^g/{
+       p
+       q
+       }" B | grep red || {
+               echo "BAD: should have listed our change first"
+               exit 1
+       }
+       test "$(git diff white N | wc -l)" -eq 0 || {
+               echo "BAD: should have taken colored branch"
+               exit 1
+       }
+'
+
 test_done