builtin-am: support and auto-detect mercurial patches
[gitweb.git] / t / t4151-am-abort.sh
index 1274f75a609765a1323aa23ba5fe48abee0beb69..05bdc3ee49408ac1ab35fe54d0b3bfbe401bf7cf 100755 (executable)
@@ -21,7 +21,7 @@ test_expect_success setup '
                echo $i >otherfile-$i &&
                git add otherfile-$i &&
                test_tick &&
-               git commit -a -m $i || break
+               git commit -a -m $i || return 1
        done &&
        git format-patch --no-numbered initial &&
        git checkout -b side initial &&
@@ -95,6 +95,21 @@ test_expect_success 'am --abort will keep the local commits intact' '
        test_cmp expect actual
 '
 
+test_expect_success 'am --abort will keep dirty index intact' '
+       git reset --hard initial &&
+       echo dirtyfile >dirtyfile &&
+       cp dirtyfile dirtyfile.expected &&
+       git add dirtyfile &&
+       test_must_fail git am 0001-*.patch &&
+       test_cmp_rev initial HEAD &&
+       test_path_is_file dirtyfile &&
+       test_cmp dirtyfile.expected dirtyfile &&
+       git am --abort &&
+       test_cmp_rev initial HEAD &&
+       test_path_is_file dirtyfile &&
+       test_cmp dirtyfile.expected dirtyfile
+'
+
 test_expect_success 'am -3 stops on conflict on unborn branch' '
        git checkout -f --orphan orphan &&
        git reset &&