diff options
author | Alban Gruin <alban.gruin@gmail.com> | 2018-08-10 18:51:29 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-10 11:56:22 -0700 |
commit | 145e05ac44b4c574fc22e6d3af7c5a14ad9b7335 (patch) | |
tree | fb734ec1b491fdef761a6800d573a2c32b5a5c4d /git-rebase--interactive.sh | |
parent | sequencer: make three functions and an enum from sequencer.c public (diff) | |
download | tgif-145e05ac44b4c574fc22e6d3af7c5a14ad9b7335.tar.xz |
rebase -i: rewrite append_todo_help() in C
This rewrites append_todo_help() from shell to C. It also incorporates
some parts of initiate_action() and complete_action() that also write
help texts to the todo file.
This also introduces the source file rebase-interactive.c. This file
will contain functions necessary for interactive rebase that are too
specific for the sequencer, and is part of libgit.a.
Two flags are added to rebase--helper.c: one to call
append_todo_help() (`--append-todo-help`), and another one to tell
append_todo_help() to write the help text suited for the edit-todo
mode (`--write-edit-todo`).
Finally, append_todo_help() is removed from git-rebase--interactive.sh
to use `rebase--helper --append-todo-help` instead.
Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rw-r--r-- | git-rebase--interactive.sh | 52 |
1 files changed, 2 insertions, 50 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 299ded2137..94c23a7af2 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -39,38 +39,6 @@ comment_for_reflog () { esac } -append_todo_help () { - gettext " -Commands: -p, pick <commit> = use commit -r, reword <commit> = use commit, but edit the commit message -e, edit <commit> = use commit, but stop for amending -s, squash <commit> = use commit, but meld into previous commit -f, fixup <commit> = like \"squash\", but discard this commit's log message -x, exec <command> = run command (the rest of the line) using shell -d, drop <commit> = remove commit -l, label <label> = label current HEAD with a name -t, reset <label> = reset HEAD to a label -m, merge [-C <commit> | -c <commit>] <label> [# <oneline>] -. create a merge commit using the original merge commit's -. message (or the oneline, if no original merge commit was -. specified). Use -c <commit> to reword the commit message. - -These lines can be re-ordered; they are executed from top to bottom. -" | git stripspace --comment-lines >>"$todo" - - if test $(get_missing_commit_check_level) = error - then - gettext " -Do not remove any line. Use 'drop' explicitly to remove a commit. -" | git stripspace --comment-lines >>"$todo" - else - gettext " -If you remove a line here THAT COMMIT WILL BE LOST. -" | git stripspace --comment-lines >>"$todo" - fi -} - die_abort () { apply_autostash rm -rf "$state_dir" @@ -143,13 +111,7 @@ initiate_action () { git stripspace --strip-comments <"$todo" >"$todo".new mv -f "$todo".new "$todo" collapse_todo_ids - append_todo_help - gettext " -You are editing the todo file of an ongoing interactive rebase. -To continue rebase after editing, run: - git rebase --continue - -" | git stripspace --comment-lines >>"$todo" + git rebase--helper --append-todo-help --write-edit-todo git_sequence_editor "$todo" || die "$(gettext "Could not execute editor")" @@ -220,17 +182,7 @@ $comment_char $(eval_ngettext \ "Rebase \$shortrevisions onto \$shortonto (\$todocount commands)" \ "$todocount") EOF - append_todo_help - gettext " - However, if you remove everything, the rebase will be aborted. - - " | git stripspace --comment-lines >>"$todo" - - if test -z "$keep_empty" - then - printf '%s\n' "$comment_char $(gettext "Note that empty commits are commented out")" >>"$todo" - fi - + git rebase--helper --append-todo-help ${keep_empty:+--keep-empty} has_action "$todo" || return 2 |