git-am: make it easier after fixing up an unapplicable patch.
[gitweb.git] / git-am.sh
index 51ea168e03b0d1e4a906f5f17ead431ca3884502..fd0772d900211557200c542b882ead04842f6628 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -153,6 +153,7 @@ if test -d "$dotest"
 then
        test ",$#," = ",0," ||
        die "previous dotest directory $dotest still exists but mbox given."
+       resume=yes
 else
        # Make sure we are not given --skip
        test ",$skip," = ,, ||
@@ -215,10 +216,15 @@ do
                go_next
                continue
        }
-       git-mailinfo $keep $utf8 "$dotest/msg" "$dotest/patch" \
-               <"$dotest/$msgnum" >"$dotest/info" ||
-               stop_here $this
-       git-stripspace < "$dotest/msg" > "$dotest/msg-clean"
+       case "$resume" in
+       '')
+               git-mailinfo $keep $utf8 "$dotest/msg" "$dotest/patch" \
+                       <"$dotest/$msgnum" >"$dotest/info" ||
+                       stop_here $this
+               git-stripspace < "$dotest/msg" > "$dotest/msg-clean"
+               ;;
+       esac
+       resume=
 
        GIT_AUTHOR_NAME="$(sed -n '/^Author/ s/Author: //p' "$dotest/info")"
        GIT_AUTHOR_EMAIL="$(sed -n '/^Email/ s/Email: //p' "$dotest/info")"