rebase -i: return control to caller, for housekeeping
[gitweb.git] / git-rebase.sh
index d6c52e6f9041bed6bbd575f51e604cada7dfb842..f8b533d18352c86b16b4507870517b8fe57b26ee 100755 (executable)
@@ -8,7 +8,7 @@ OPTIONS_KEEPDASHDASH=
 OPTIONS_SPEC="\
 git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] [<upstream>] [<branch>]
 git rebase [-i] [options] [--exec <cmd>] [--onto <newbase>] --root [<branch>]
-git-rebase [-i] --continue | --abort | --skip
+git-rebase --continue | --abort | --skip | --edit-todo
 --
  Available options are
 v,verbose!         display a diffstat of what changed upstream
@@ -38,6 +38,7 @@ C=!                passed to 'git apply'
 continue!          continue
 abort!             abort and check out the original branch
 skip!              skip current patch and continue
+edit-todo!         edit the todo list during an interactive rebase
 "
 . git-sh-setup
 . git-sh-i18n
@@ -149,6 +150,13 @@ run_specific_rebase () {
                autosquash=
        fi
        . git-rebase--$type
+       ret=$?
+       if test $ret -eq 0
+       then
+               git gc --auto &&
+               rm -rf "$state_dir"
+       fi
+       exit $ret
 }
 
 run_pre_rebase_hook () {
@@ -190,7 +198,7 @@ do
        --verify)
                ok_to_skip_pre_rebase=
                ;;
-       --continue|--skip|--abort)
+       --continue|--skip|--abort|--edit-todo)
                test $total_argc -eq 2 || usage
                action=${1##--}
                ;;
@@ -306,6 +314,11 @@ then
        fi
 fi
 
+if test "$action" = "edit-todo" && test "$type" != "interactive"
+then
+       die "$(gettext "The --edit-todo action can only be used during interactive rebase.")"
+fi
+
 case "$action" in
 continue)
        # Sanity check
@@ -338,6 +351,9 @@ abort)
        rm -r "$state_dir"
        exit
        ;;
+edit-todo)
+       run_specific_rebase
+       ;;
 esac
 
 # Make sure no rebase is in progress