GIT 0.99.9e
[gitweb.git] / git-am.sh
index 51ea168e03b0d1e4a906f5f17ead431ca3884502..115ebaddf595f49059208ac890308b6ebe01aa42 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")"
@@ -264,14 +270,17 @@ do
                echo "--------------------------"
                cat "$dotest/final-commit"
                echo "--------------------------"
-               echo -n "Apply? [y]es/[n]o/[e]dit/[a]ccept all "
+               echo -n "Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all "
                read reply
                case "$reply" in
-               y*|Y*) action=yes ;;
-               a*|A*) action=yes interactive= ;;
-               n*|N*) action=skip ;;
-               e*|E*) "${VISUAL:-${EDITOR:-vi}}" "$dotest/final-commit"
+               [yY]*) action=yes ;;
+               [aA]*) action=yes interactive= ;;
+               [nN]*) action=skip ;;
+               [eE]*) "${VISUAL:-${EDITOR:-vi}}" "$dotest/final-commit"
                       action=again ;;
+               [vV]*) action=again
+                      LESS=-S ${PAGER:-less} "$dotest/patch" ;;
+               *)     action=again ;;
                esac
            done
        else