Merge branch 'en/abort-df-conflict-fixes'
[gitweb.git] / t / t6044-merge-unrelated-index-changes.sh
index 96012558909e8f25c5dc8ba28d9bb0d2d2acbc95..5e3779ebc9310bfb25d0c6579f234ecf4fabd12e 100755 (executable)
@@ -137,7 +137,7 @@ test_expect_success 'merge-recursive, when index==head but head!=HEAD' '
        test_i18ngrep "Already up to date" out
 '
 
-test_expect_failure 'recursive, when file has staged changes not matching HEAD nor what a merge would give' '
+test_expect_success 'recursive, when file has staged changes not matching HEAD nor what a merge would give' '
        git reset --hard &&
        git checkout B^0 &&
 
@@ -145,14 +145,12 @@ test_expect_failure 'recursive, when file has staged changes not matching HEAD n
        test_seq 1 10 >subdir/a &&
        git add subdir/a &&
 
-       # HEAD has no subdir/a; merge would write 1..11 to subdir/a;
-       # Since subdir/a matches neither HEAD nor what the merge would write
-       # to that file, the merge should fail to avoid overwriting what is
-       # currently found in subdir/a
-       test_must_fail git merge -s recursive E^0
+       # We have staged changes; merge should error out
+       test_must_fail git merge -s recursive E^0 2>err &&
+       test_i18ngrep "changes to the following files would be overwritten" err
 '
 
-test_expect_failure 'recursive, when file has staged changes matching what a merge would give' '
+test_expect_success 'recursive, when file has staged changes matching what a merge would give' '
        git reset --hard &&
        git checkout B^0 &&
 
@@ -160,10 +158,9 @@ test_expect_failure 'recursive, when file has staged changes matching what a mer
        test_seq 1 11 >subdir/a &&
        git add subdir/a &&
 
-       # HEAD has no subdir/a; merge would write 1..11 to subdir/a;
-       # Since subdir/a matches what the merge would write to that file,
-       # the merge should be safe to proceed
-       git merge -s recursive E^0
+       # We have staged changes; merge should error out
+       test_must_fail git merge -s recursive E^0 2>err &&
+       test_i18ngrep "changes to the following files would be overwritten" err
 '
 
 test_expect_success 'octopus, unrelated file touched' '