Merge branch 'ag/rebase-i-in-c'

Rewrite of the remaining "rebase -i" machinery in C.

* ag/rebase-i-in-c:
  rebase -i: move rebase--helper modes to rebase--interactive
  rebase -i: remove git-rebase--interactive.sh
  rebase--interactive2: rewrite the submodes of interactive rebase in C
  rebase -i: implement the main part of interactive rebase as a builtin
  rebase -i: rewrite init_basic_state() in C
  rebase -i: rewrite write_basic_state() in C
  rebase -i: rewrite the rest of init_revisions_and_shortrevisions() in C
  rebase -i: implement the logic to initialize $revisions in C
  rebase -i: remove unused modes and functions
  rebase -i: rewrite complete_action() in C
  t3404: todo list with commented-out commands only aborts
  sequencer: change the way skip_unnecessary_picks() returns its result
  sequencer: refactor append_todo_help() to write its message to a buffer
  rebase -i: rewrite checkout_onto() in C
  rebase -i: rewrite setup_reflog_action() in C
  sequencer: add a new function to silence a command, except if it fails
  rebase -i: rewrite the edit-todo functionality in C
  editor: add a function to launch the sequence editor
  rebase -i: rewrite append_todo_help() in C
  sequencer: make three functions and an enum from sequencer.c public
This commit is contained in:
Junio C Hamano
2018-11-02 11:04:53 +09:00
17 changed files with 742 additions and 451 deletions

View File

@ -135,26 +135,63 @@ finish_rebase () {
rm -rf "$state_dir"
}
run_interactive () {
GIT_CHERRY_PICK_HELP="$resolvemsg"
export GIT_CHERRY_PICK_HELP
test -n "$keep_empty" && keep_empty="--keep-empty"
test -n "$rebase_merges" && rebase_merges="--rebase-merges"
test -n "$rebase_cousins" && rebase_cousins="--rebase-cousins"
test -n "$autosquash" && autosquash="--autosquash"
test -n "$verbose" && verbose="--verbose"
test -n "$force_rebase" && force_rebase="--no-ff"
test -n "$restrict_revision" && \
restrict_revision="--restrict-revision=^$restrict_revision"
test -n "$upstream" && upstream="--upstream=$upstream"
test -n "$onto" && onto="--onto=$onto"
test -n "$squash_onto" && squash_onto="--squash-onto=$squash_onto"
test -n "$onto_name" && onto_name="--onto-name=$onto_name"
test -n "$head_name" && head_name="--head-name=$head_name"
test -n "$strategy" && strategy="--strategy=$strategy"
test -n "$strategy_opts" && strategy_opts="--strategy-opts=$strategy_opts"
test -n "$switch_to" && switch_to="--switch-to=$switch_to"
test -n "$cmd" && cmd="--cmd=$cmd"
test -n "$action" && action="--$action"
exec git rebase--interactive "$action" "$keep_empty" "$rebase_merges" "$rebase_cousins" \
"$upstream" "$onto" "$squash_onto" "$restrict_revision" \
"$allow_empty_message" "$autosquash" "$verbose" \
"$force_rebase" "$onto_name" "$head_name" "$strategy" \
"$strategy_opts" "$cmd" "$switch_to" \
"$allow_rerere_autoupdate" "$gpg_sign_opt" "$signoff"
}
run_specific_rebase () {
if [ "$interactive_rebase" = implied ]; then
GIT_EDITOR=:
export GIT_EDITOR
autosquash=
fi
. git-rebase--$type
if test -z "$preserve_merges"
if test -n "$interactive_rebase" -a -z "$preserve_merges"
then
git_rebase__$type
run_interactive
else
git_rebase__preserve_merges
. git-rebase--$type
if test -z "$preserve_merges"
then
git_rebase__$type
else
git_rebase__preserve_merges
fi
fi
ret=$?
if test $ret -eq 0
then
finish_rebase
elif test $ret -eq 2 # special exit status for rebase -i
elif test $ret -eq 2 # special exit status for rebase -p
then
apply_autostash &&
rm -rf "$state_dir" &&