Skip to content

Commit 04efc8b

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4a5146f commit 04efc8b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sequencer.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ enum todo_command {
718718
TODO_PICK = 0,
719719
TODO_REVERT,
720720
TODO_EDIT,
721+
TODO_REWORD,
721722
TODO_FIXUP,
722723
TODO_SQUASH,
723724
/* commands that do something else than handling a single commit */
@@ -733,6 +734,7 @@ static struct {
733734
{ 'p', "pick" },
734735
{ 0, "revert" },
735736
{ 'e', "edit" },
737+
{ 'r', "reword" },
736738
{ 'f', "fixup" },
737739
{ 's', "squash" },
738740
{ 'x', "exec" },
@@ -962,7 +964,9 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
962964
}
963965
}
964966

965-
if (is_fixup(command)) {
967+
if (command == TODO_REWORD)
968+
edit = 1;
969+
else if (is_fixup(command)) {
966970
if (update_squash_messages(command, commit, opts))
967971
return -1;
968972
amend = 1;
@@ -1771,7 +1775,8 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
17711775
item->arg_len, item->arg);
17721776
} else if (res && is_rebase_i(opts))
17731777
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);
17751780
} else if (item->command == TODO_EXEC) {
17761781
char *end_of_arg = (char *)(item->arg + item->arg_len);
17771782
int saved = *end_of_arg;

0 commit comments

Comments
 (0)