sequencer (rebase -i): implement the 'reword' command

This is now trivial, as all the building blocks are in place: all we need to do is to flip the "edit" switch when committing. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jan 2, 2017 at 16:28 UTC 04efc8b57c17ab31de1c4c53e52838659dfeecc5
1 file changed +7 -2
sequencer.c
+7 -2
@@ -718,6 +718,7 @@ enum todo_command {
718 TODO_PICK = 0,
719 TODO_REVERT,
720 TODO_EDIT,
721 + TODO_REWORD,
722 TODO_FIXUP,
723 TODO_SQUASH,
724 /* commands that do something else than handling a single commit */
@@ -733,6 +734,7 @@ static struct {
734 { 'p', "pick" },
735 { 0, "revert" },
736 { 'e', "edit" },
737 + { 'r', "reword" },
738 { 'f', "fixup" },
739 { 's', "squash" },
740 { 'x', "exec" },
@@ -962,7 +964,9 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
964 }
965 }
966
965 - if (is_fixup(command)) {
967 + if (command == TODO_REWORD)
968 + edit = 1;
969 + else if (is_fixup(command)) {
970 if (update_squash_messages(command, commit, opts))
971 return -1;
972 amend = 1;
@@ -1771,7 +1775,8 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
1775 item->arg_len, item->arg);
1776 } else if (res && is_rebase_i(opts))
1777 return res | error_with_patch(item->commit,
1774 - item->arg, item->arg_len, opts, res, 0);
1778 + item->arg, item->arg_len, opts, res,
1779 + item->command == TODO_REWORD);
1780 } else if (item->command == TODO_EXEC) {
1781 char *end_of_arg = (char *)(item->arg + item->arg_len);
1782 int saved = *end_of_arg;