Merge branch 'jc/maint-rebase-rewrite-last-skip'
authorJunio C Hamano <gitster@pobox.com>
Tue, 28 Dec 2010 19:26:59 +0000 (11:26 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Dec 2010 19:26:59 +0000 (11:26 -0800)
* jc/maint-rebase-rewrite-last-skip:
rebase --skip: correctly wrap-up when skipping the last patch

1  2 
git-am.sh
diff --combined git-am.sh
index cf1f64b574b180332105d95295dfa35c8f6e10bb,69474e5da29c1bb121ae69432c06b63095b5bee6..6cdd5910db50c96df3d149fba172750cb10c09cb
+++ b/git-am.sh
@@@ -68,31 -68,9 +68,31 @@@ sq () 
  
  stop_here () {
      echo "$1" >"$dotest/next"
 +    git rev-parse --verify -q HEAD >"$dotest/abort-safety"
      exit 1
  }
  
 +safe_to_abort () {
 +      if test -f "$dotest/dirtyindex"
 +      then
 +              return 1
 +      fi
 +
 +      if ! test -s "$dotest/abort-safety"
 +      then
 +              return 0
 +      fi
 +
 +      abort_safety=$(cat "$dotest/abort-safety")
 +      if test "z$(git rev-parse --verify -q HEAD)" = "z$abort_safety"
 +      then
 +              return 0
 +      fi
 +      echo >&2 "You seem to have moved HEAD since the last 'am' failure."
 +      echo >&2 "Not rewinding to ORIG_HEAD"
 +      return 1
 +}
 +
  stop_here_user_resolve () {
      if [ -n "$resolvemsg" ]; then
            printf '%s\n' "$resolvemsg"
@@@ -441,11 -419,10 +441,11 @@@ the
                        exec git rebase --abort
                fi
                git rerere clear
 -              test -f "$dotest/dirtyindex" || {
 +              if safe_to_abort
 +              then
                        git read-tree --reset -u HEAD ORIG_HEAD
                        git reset ORIG_HEAD
 -              }
 +              fi
                rm -fr "$dotest"
                exit ;;
        esac
@@@ -467,12 -444,12 +467,12 @@@ els
                                set x
                                first=
                        }
 -                      case "$arg" in
 -                      /*)
 -                              set "$@" "$arg" ;;
 -                      *)
 -                              set "$@" "$prefix$arg" ;;
 -                      esac
 +                      if is_absolute_path "$arg"
 +                      then
 +                              set "$@" "$arg"
 +                      else
 +                              set "$@" "$prefix$arg"
 +                      fi
                done
                shift
        fi
@@@ -577,13 -554,6 +577,6 @@@ the
        resume=
  fi
  
- if test "$this" -gt "$last"
- then
-       say Nothing to do.
-       rm -fr "$dotest"
-       exit
- fi
  while test "$this" -le "$last"
  do
        msgnum=`printf "%0${prec}d" $this`