diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2016-10-21 14:25:28 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-10-21 09:32:34 -0700 |
commit | 0009426d6721a0356d41811aa34b4ac7f278a76e (patch) | |
tree | 5cd8229a0d4ad1a60a04a5bbc5938eccd29c4cc0 /sequencer.c | |
parent | 9240beda621dc0b4eec66f5ad9a8258c0f614e4c (diff) | |
download | git-0009426d6721a0356d41811aa34b4ac7f278a76e.tar.gz |
sequencer: support cleaning up commit messages
The run_git_commit() function already knows how to amend commits, and
with this new option, it can also clean up commit messages (i.e. strip
out commented lines). This is needed to implement rebase -i's 'fixup'
and 'squash' commands as sequencer commands.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sequencer.c b/sequencer.c index 1ef50a0999..8646ca56ff 100644 --- a/sequencer.c +++ b/sequencer.c @@ -484,7 +484,8 @@ static char **read_author_script(void) * author metadata. */ static int run_git_commit(const char *defmsg, struct replay_opts *opts, - int allow_empty, int edit, int amend) + int allow_empty, int edit, int amend, + int cleanup_commit_message) { char **env = NULL; struct argv_array array; @@ -521,9 +522,12 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts, argv_array_push(&array, "-s"); if (defmsg) argv_array_pushl(&array, "-F", defmsg, NULL); + if (cleanup_commit_message) + argv_array_push(&array, "--cleanup=strip"); if (edit) argv_array_push(&array, "-e"); - else if (!opts->signoff && !opts->record_origin && + else if (!cleanup_commit_message && + !opts->signoff && !opts->record_origin && git_config_get_value("commit.cleanup", &value)) argv_array_push(&array, "--cleanup=verbatim"); @@ -788,7 +792,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit, } if (!opts->no_commit) res = run_git_commit(opts->edit ? NULL : git_path_merge_msg(), - opts, allow, opts->edit, 0); + opts, allow, opts->edit, 0, 0); leave: free_message(commit, &msg); |