bash prompt: use bash builtins to find out rebase state
[gitweb.git] / git-rebase.sh
index d0c11a910a69603ac19c83a5d29af9f32f780267..2d5c2bd0fcf773367b892fbb993704e5f2089c64 100755 (executable)
@@ -84,6 +84,8 @@ keep_empty=
 test "$(git config --bool rebase.autosquash)" = "true" && autosquash=t
 
 read_basic_state () {
+       test -f "$state_dir/head-name" &&
+       test -f "$state_dir/onto" &&
        head_name=$(cat "$state_dir"/head-name) &&
        onto=$(cat "$state_dir"/onto) &&
        # We always write to orig-head, but interactive rebase used to write to
@@ -545,6 +547,7 @@ then
                # Lazily switch to the target branch if needed...
                test -z "$switch_to" || git checkout "$switch_to" --
                say "$(eval_gettext "Current branch \$branch_name is up to date.")"
+               finish_rebase
                exit 0
        else
                say "$(eval_gettext "Current branch \$branch_name is up to date, rebase forced.")"
@@ -577,6 +580,7 @@ if test "$mb" = "$orig_head"
 then
        say "$(eval_gettext "Fast-forwarded \$branch_name to \$onto_name.")"
        move_to_original_branch
+       finish_rebase
        exit 0
 fi