t3404: todo list with commented-out commands only aborts
[gitweb.git] / git-rebase--interactive.sh
index 94c23a7af2291fbfc0e390966e3455ab0f1083ca..b68f108f28dafb779ceaf2b0f255fe0db291b038 100644 (file)
@@ -28,17 +28,6 @@ case "$comment_char" in
        ;;
 esac
 
-orig_reflog_action="$GIT_REFLOG_ACTION"
-
-comment_for_reflog () {
-       case "$orig_reflog_action" in
-       ''|rebase*)
-               GIT_REFLOG_ACTION="rebase -i ($1)"
-               export GIT_REFLOG_ACTION
-               ;;
-       esac
-}
-
 die_abort () {
        apply_autostash
        rm -rf "$state_dir"
@@ -70,13 +59,6 @@ collapse_todo_ids() {
        git rebase--helper --shorten-ids
 }
 
-# Switch to the branch in $into and notify it in the reflog
-checkout_onto () {
-       GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name"
-       output git checkout $onto || die_abort "$(gettext "could not detach HEAD")"
-       git update-ref ORIG_HEAD $orig_head
-}
-
 get_missing_commit_check_level () {
        check_level=$(git config --get rebase.missingCommitsCheck)
        check_level=${check_level:-ignore}
@@ -108,16 +90,7 @@ initiate_action () {
                     --continue
                ;;
        edit-todo)
-               git stripspace --strip-comments <"$todo" >"$todo".new
-               mv -f "$todo".new "$todo"
-               collapse_todo_ids
-               git rebase--helper --append-todo-help --write-edit-todo
-
-               git_sequence_editor "$todo" ||
-                       die "$(gettext "Could not execute editor")"
-               expand_todo_ids
-
-               exit
+               exec git rebase--helper --edit-todo
                ;;
        show-current-patch)
                exec git show REBASE_HEAD --
@@ -128,19 +101,6 @@ initiate_action () {
        esac
 }
 
-setup_reflog_action () {
-       comment_for_reflog start
-
-       if test ! -z "$switch_to"
-       then
-               GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $switch_to"
-               output git checkout "$switch_to" -- ||
-                       die "$(eval_gettext "Could not checkout \$switch_to")"
-
-               comment_for_reflog start
-       fi
-}
-
 init_basic_state () {
        orig_head=$(git rev-parse --verify HEAD) || die "$(gettext "No HEAD?")"
        mkdir -p "$state_dir" || die "$(eval_gettext "Could not create temporary \$state_dir")"
@@ -197,7 +157,8 @@ EOF
 
        git rebase--helper --check-todo-list || {
                ret=$?
-               checkout_onto
+               git rebase--helper --checkout-onto "$onto_name" "$onto" \
+                   "$orig_head" ${verbose:+--verbose}
                exit $ret
        }
 
@@ -207,7 +168,8 @@ EOF
        onto="$(git rebase--helper --skip-unnecessary-picks)" ||
        die "Could not skip unnecessary pick commands"
 
-       checkout_onto
+       git rebase--helper --checkout-onto "$onto_name" "$onto" "$orig_head" \
+           ${verbose:+--verbose}
        require_clean_work_tree "rebase"
        exec git rebase--helper ${force_rebase:+--no-ff} $allow_empty_message \
             --continue
@@ -220,7 +182,7 @@ git_rebase__interactive () {
                return 0
        fi
 
-       setup_reflog_action
+       git rebase--helper --prepare-branch "$switch_to" ${verbose:+--verbose}
        init_basic_state
 
        init_revisions_and_shortrevisions