mirror of
https://github.com/git/git.git
synced 2026-01-28 19:41:36 +00:00
sequencer: allow editing the commit message on a case-by-case basis
In the upcoming commits, we will implement more and more of rebase -i's functionality. One particular feature of the commands to come is that some of them allow editing the commit message while others don't, i.e. we cannot define in the replay_opts whether the commit message should be edited or not. Let's add a new parameter to the sequencer_commit() function. Previously, it was the duty of the caller to ensure that the opts->edit setting indicates whether to let the user edit the commit message or not, indicating that it is an "all or nothing" setting, i.e. that the sequencer wants to let the user edit *all* commit message, or none at all. In the upcoming rebase -i mode, it will depend on the particular command that is currently executed, though. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -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 allow_empty, int edit)
|
||||
{
|
||||
char **env = NULL;
|
||||
struct argv_array array;
|
||||
@@ -520,7 +520,7 @@ int sequencer_commit(const char *defmsg, struct replay_opts *opts,
|
||||
argv_array_push(&array, "-s");
|
||||
if (defmsg)
|
||||
argv_array_pushl(&array, "-F", defmsg, NULL);
|
||||
if (opts->edit)
|
||||
if (edit)
|
||||
argv_array_push(&array, "-e");
|
||||
else if (!opts->signoff && !opts->record_origin &&
|
||||
git_config_get_value("commit.cleanup", &value))
|
||||
@@ -786,7 +786,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, allow, opts->edit);
|
||||
|
||||
leave:
|
||||
free_message(commit, &msg);
|
||||
|
||||
@@ -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 allow_empty, int edit);
|
||||
|
||||
extern const char sign_off_header[];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user