Code

revision traversal: show full history with merge simplification
[git.git] / git-am.sh
index 60aaa4a583d3e2466ea788d7047a9fc8252b1fe6..8f91a97eb3a07908b35de086d555822c928fd2e9 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -6,8 +6,7 @@ SUBDIRECTORY_OK=Yes
 OPTIONS_KEEPDASHDASH=
 OPTIONS_SPEC="\
 git am [options] [<mbox>|<Maildir>...]
-git am [options] --resolved
-git am [options] --skip
+git am [options] (--resolved | --skip | --abort)
 --
 d,dotest=       (removed -- do not use)
 i,interactive   run interactively
@@ -44,7 +43,7 @@ stop_here_user_resolve () {
            printf '%s\n' "$resolvemsg"
            stop_here $1
     fi
-    cmdline=$(basename $0)
+    cmdline="git am"
     if test '' != "$interactive"
     then
         cmdline="$cmdline -i"
@@ -121,7 +120,7 @@ It does not apply to blobs recorded in its index."
 }
 
 prec=4
-dotest="$GIT_DIR/rebase"
+dotest="$GIT_DIR/rebase-apply"
 sign= utf8=t keep= skip= interactive= resolved= binary= rebasing= abort=
 resolvemsg= resume=
 git_apply_opt=
@@ -202,8 +201,15 @@ then
        die "previous rebase directory $dotest still exists but mbox given."
        resume=yes
 
-       case "$abort" in
-       t)
+       case "$skip,$abort" in
+       t,)
+               git rerere clear
+               git read-tree --reset -u HEAD HEAD
+               orig_head=$(cat "$GIT_DIR/ORIG_HEAD")
+               git reset HEAD
+               git update-ref ORIG_HEAD $orig_head
+               ;;
+       ,t)
                git rerere clear
                git read-tree --reset -u HEAD ORIG_HEAD
                git reset ORIG_HEAD
@@ -285,7 +291,7 @@ fi
 ws=`cat "$dotest/whitespace"`
 if test "$(cat "$dotest/sign")" = t
 then
-       SIGNOFF=`git-var GIT_COMMITTER_IDENT | sed -e '
+       SIGNOFF=`git var GIT_COMMITTER_IDENT | sed -e '
                        s/>.*/>/
                        s/^/Signed-off-by: /'
                `
@@ -297,7 +303,6 @@ last=`cat "$dotest/last"`
 this=`cat "$dotest/next"`
 if test "$skip" = t
 then
-       git rerere clear
        this=`expr "$this" + 1`
        resume=
 fi
@@ -450,7 +455,7 @@ do
                stop_here $this
        fi
 
-       printf 'Applying %s\n' "$FIRSTLINE"
+       printf 'Applying: %s\n' "$FIRSTLINE"
 
        case "$resolved" in
        '')