Skip to content

Commit fbb71fb

Browse files
committed
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. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 9659822 commit fbb71fb

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

sequencer.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ static char **read_author_script()
468468
* (except, of course, while running an interactive rebase).
469469
*/
470470
int sequencer_commit(const char *defmsg, struct replay_opts *opts,
471-
int allow_empty)
471+
int allow_empty, int edit)
472472
{
473473
char **env = NULL;
474474
struct argv_array array;
@@ -502,15 +502,15 @@ int sequencer_commit(const char *defmsg, struct replay_opts *opts,
502502
argv_array_pushf(&array, "-S%s", opts->gpg_sign);
503503
if (opts->signoff)
504504
argv_array_push(&array, "-s");
505-
if (!opts->edit || IS_REBASE_I()) {
505+
if (!edit || IS_REBASE_I()) {
506506
argv_array_push(&array, "-F");
507507
argv_array_push(&array, defmsg);
508508
if (!opts->signoff &&
509509
!opts->record_origin &&
510510
git_config_get_value("commit.cleanup", &value))
511511
argv_array_push(&array, "--cleanup=verbatim");
512512
}
513-
if (opts->edit && IS_REBASE_I())
513+
if (edit && IS_REBASE_I())
514514
argv_array_push(&array, "-e");
515515

516516
if (allow_empty)
@@ -777,7 +777,8 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
777777
goto leave;
778778
}
779779
if (!opts->no_commit)
780-
res = sequencer_commit(git_path_merge_msg(), opts, allow);
780+
res = sequencer_commit(git_path_merge_msg(), opts, allow,
781+
opts->edit);
781782

782783
leave:
783784
free_message(commit, &msg);

sequencer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int sequencer_rollback(struct replay_opts *opts);
4545
int sequencer_remove_state(struct replay_opts *opts);
4646

4747
int sequencer_commit(const char *defmsg, struct replay_opts *opts,
48-
int allow_empty);
48+
int allow_empty, int edit);
4949

5050
extern const char sign_off_header[];
5151

0 commit comments

Comments
 (0)