Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sequencer (rebase -i): implement the 'reword' command
author
Johannes Schindelin
<johannes.schindelin@gmx.de>
Mon, 2 Jan 2017 15:28:00 +0000
(16:28 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 9 Jan 2017 22:57:30 +0000
(14:57 -0800)
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>
sequencer.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (from parent 1:
4a5146f
)
diff --git
a/sequencer.c
b/sequencer.c
index a2002f1c12e44189397dd0527cf7cb9f2703a5dc..50e998acc4c5749fbd37b1dfbcf73dc495a7f233 100644
(file)
--- a/
sequencer.c
+++ b/
sequencer.c
@@
-718,6
+718,7
@@
enum todo_command {
TODO_PICK = 0,
TODO_REVERT,
TODO_EDIT,
TODO_PICK = 0,
TODO_REVERT,
TODO_EDIT,
+ TODO_REWORD,
TODO_FIXUP,
TODO_SQUASH,
/* commands that do something else than handling a single commit */
TODO_FIXUP,
TODO_SQUASH,
/* commands that do something else than handling a single commit */
@@
-733,6
+734,7
@@
static struct {
{ 'p', "pick" },
{ 0, "revert" },
{ 'e', "edit" },
{ 'p', "pick" },
{ 0, "revert" },
{ 'e', "edit" },
+ { 'r', "reword" },
{ 'f', "fixup" },
{ 's', "squash" },
{ 'x', "exec" },
{ 'f', "fixup" },
{ 's', "squash" },
{ 'x', "exec" },
@@
-962,7
+964,9
@@
static int do_pick_commit(enum todo_command command, struct commit *commit,
}
}
}
}
- if (is_fixup(command)) {
+ if (command == TODO_REWORD)
+ edit = 1;
+ else if (is_fixup(command)) {
if (update_squash_messages(command, commit, opts))
return -1;
amend = 1;
if (update_squash_messages(command, commit, opts))
return -1;
amend = 1;
@@
-1771,7
+1775,8
@@
static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
item->arg_len, item->arg);
} else if (res && is_rebase_i(opts))
return res | error_with_patch(item->commit,
item->arg_len, item->arg);
} else if (res && is_rebase_i(opts))
return res | error_with_patch(item->commit,
- item->arg, item->arg_len, opts, res, 0);
+ item->arg, item->arg_len, opts, res,
+ item->command == TODO_REWORD);
} else if (item->command == TODO_EXEC) {
char *end_of_arg = (char *)(item->arg + item->arg_len);
int saved = *end_of_arg;
} else if (item->command == TODO_EXEC) {
char *end_of_arg = (char *)(item->arg + item->arg_len);
int saved = *end_of_arg;