Code

mingw: move unlink wrapper to mingw.c
[git.git] / git-rebase.sh
index 10a238ae3cc942bc021db18195b7098e2866c266..d8e190302668ca352fd58cd052a677347a29cdcd 100755 (executable)
@@ -49,7 +49,8 @@ do_merge=
 dotest="$GIT_DIR"/rebase-merge
 prec=4
 verbose=
-diffstat=$(git config --bool rebase.stat)
+diffstat=
+test "$(git config --bool rebase.stat)" = true && diffstat=t
 git_am_opt=
 rebase_root=
 force_rebase=
@@ -205,6 +206,9 @@ do
        --no-verify)
                OK_TO_SKIP_PRE_REBASE=yes
                ;;
+       --verify)
+               OK_TO_SKIP_PRE_REBASE=
+               ;;
        --continue)
                test -d "$dotest" -o -d "$GIT_DIR"/rebase-apply ||
                        die "No rebase in progress?"
@@ -274,15 +278,16 @@ do
                        die "No rebase in progress?"
 
                git rerere clear
-               if test -d "$dotest"
-               then
-                       GIT_QUIET=$(cat "$dotest/quiet")
-                       move_to_original_branch
-               else
-                       dotest="$GIT_DIR"/rebase-apply
-                       GIT_QUIET=$(cat "$dotest/quiet")
-                       move_to_original_branch
-               fi
+
+               test -d "$dotest" || dotest="$GIT_DIR"/rebase-apply
+
+               head_name="$(cat "$dotest"/head-name)" &&
+               case "$head_name" in
+               refs/*)
+                       git symbolic-ref HEAD $head_name ||
+                       die "Could not move back to $head_name"
+                       ;;
+               esac
                git reset --hard $(cat "$dotest/orig-head")
                rm -r "$dotest"
                exit
@@ -412,19 +417,7 @@ else
        fi
 fi
 
-# The tree must be really really clean.
-if ! git update-index --ignore-submodules --refresh > /dev/null; then
-       echo >&2 "cannot rebase: you have unstaged changes"
-       git diff-files --name-status -r --ignore-submodules -- >&2
-       exit 1
-fi
-diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
-case "$diff" in
-?*)    echo >&2 "cannot rebase: your index contains uncommitted changes"
-       echo >&2 "$diff"
-       exit 1
-       ;;
-esac
+require_clean_work_tree "rebase" "Please commit or stash them."
 
 if test -z "$rebase_root"
 then