]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-rebase--interactive.sh
rebase -i: rewrite complete_action() in C
[thirdparty/git.git] / git-rebase--interactive.sh
index b68f108f28dafb779ceaf2b0f255fe0db291b038..59dc4888a6da11e9cd0164449e84412c9a82cccb 100644 (file)
@@ -127,54 +127,6 @@ init_revisions_and_shortrevisions () {
        fi
 }
 
-complete_action() {
-       test -s "$todo" || echo noop >> "$todo"
-       test -z "$autosquash" || git rebase--helper --rearrange-squash || exit
-       test -n "$cmd" && git rebase--helper --add-exec-commands "$cmd"
-
-       todocount=$(git stripspace --strip-comments <"$todo" | wc -l)
-       todocount=${todocount##* }
-
-cat >>"$todo" <<EOF
-
-$comment_char $(eval_ngettext \
-       "Rebase \$shortrevisions onto \$shortonto (\$todocount command)" \
-       "Rebase \$shortrevisions onto \$shortonto (\$todocount commands)" \
-       "$todocount")
-EOF
-       git rebase--helper --append-todo-help ${keep_empty:+--keep-empty}
-
-       has_action "$todo" ||
-               return 2
-
-       cp "$todo" "$todo".backup
-       collapse_todo_ids
-       git_sequence_editor "$todo" ||
-               die_abort "$(gettext "Could not execute editor")"
-
-       has_action "$todo" ||
-               return 2
-
-       git rebase--helper --check-todo-list || {
-               ret=$?
-               git rebase--helper --checkout-onto "$onto_name" "$onto" \
-                   "$orig_head" ${verbose:+--verbose}
-               exit $ret
-       }
-
-       expand_todo_ids
-
-       test -n "$force_rebase" ||
-       onto="$(git rebase--helper --skip-unnecessary-picks)" ||
-       die "Could not skip unnecessary pick commands"
-
-       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
-}
-
 git_rebase__interactive () {
        initiate_action "$action"
        ret=$?
@@ -193,5 +145,8 @@ git_rebase__interactive () {
                $revisions ${restrict_revision+^$restrict_revision} >"$todo" ||
        die "$(gettext "Could not generate todo list")"
 
-       complete_action
+       exec git rebase--helper --complete-action "$shortrevisions" "$onto_name" \
+               "$shortonto" "$orig_head" "$cmd" $allow_empty_message \
+               ${autosquash:+--autosquash} ${keep_empty:+--keep-empty} \
+               ${verbose:+--verbose} ${force_rebase:+--no-ff}
 }