sequencer: support amending commits

This teaches the sequencer_commit() function to take an argument that
will allow us to implement "todo" commands that need to amend the commit
messages ("fixup", "squash" and "reword").

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2016-03-04 15:01:48 +01:00
parent cd659a0be5
commit fc09e1c488
2 changed files with 5 additions and 3 deletions

View File

@@ -485,7 +485,7 @@ static char **read_author_script(void)
* author metadata.
*/
int sequencer_commit(const char *defmsg, struct replay_opts *opts,
int allow_empty, int edit)
int allow_empty, int edit, int amend)
{
char **env = NULL;
struct argv_array array;
@@ -514,6 +514,8 @@ int sequencer_commit(const char *defmsg, struct replay_opts *opts,
argv_array_push(&array, "commit");
argv_array_push(&array, "-n");
if (amend)
argv_array_push(&array, "--amend");
if (opts->gpg_sign)
argv_array_pushf(&array, "-S%s", opts->gpg_sign);
if (opts->signoff)
@@ -786,7 +788,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
}
if (!opts->no_commit)
res = sequencer_commit(opts->edit ? NULL : git_path_merge_msg(),
opts, allow, opts->edit);
opts, allow, opts->edit, 0);
leave:
free_message(commit, &msg);

View File

@@ -54,7 +54,7 @@ int sequencer_rollback(struct replay_opts *opts);
int sequencer_remove_state(struct replay_opts *opts);
int sequencer_commit(const char *defmsg, struct replay_opts *opts,
int allow_empty, int edit);
int allow_empty, int edit, int amend);
extern const char sign_off_header[];