summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-05-08 15:37:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-08 15:37:23 (GMT)
commitf757794d9dbd1152c0a557d3a07617ac2fa5bc09 (patch)
tree7f43f34e4a1c2d7ed83f473fa0e5dce87f7bdadb /sequencer.c
parent3d67555744e6d4fbbc52b0a67c4b630c5d319bc2 (diff)
parentd74f3e58114d1a8544592fcd5dcdfe0fc4993d27 (diff)
downloadgit-f757794d9dbd1152c0a557d3a07617ac2fa5bc09.zip
git-f757794d9dbd1152c0a557d3a07617ac2fa5bc09.tar.gz
git-f757794d9dbd1152c0a557d3a07617ac2fa5bc09.tar.bz2
Merge branch 'pw/sequencer-cleanup-with-signoff-x-fix'
"git cherry-pick" run with the "-x" or the "--signoff" option used to (and more importantly, ought to) clean up the commit log message with the --cleanup=space option by default, but this has been broken since late 2017. This has been fixed. * pw/sequencer-cleanup-with-signoff-x-fix: sequencer: fix cleanup with --signoff and -x
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/sequencer.c b/sequencer.c
index 546f281..5da5949 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -171,17 +171,22 @@ static int git_sequencer_config(const char *k, const char *v, void *cb)
if (status)
return status;
- if (!strcmp(s, "verbatim"))
+ if (!strcmp(s, "verbatim")) {
opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE;
- else if (!strcmp(s, "whitespace"))
+ opts->explicit_cleanup = 1;
+ } else if (!strcmp(s, "whitespace")) {
opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_SPACE;
- else if (!strcmp(s, "strip"))
+ opts->explicit_cleanup = 1;
+ } else if (!strcmp(s, "strip")) {
opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_ALL;
- else if (!strcmp(s, "scissors"))
+ opts->explicit_cleanup = 1;
+ } else if (!strcmp(s, "scissors")) {
opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_SPACE;
- else
+ opts->explicit_cleanup = 1;
+ } else {
warning(_("invalid commit message cleanup mode '%s'"),
s);
+ }
free((char *)s);
return status;
@@ -1382,8 +1387,13 @@ static int try_to_commit(struct repository *r,
msg = &commit_msg;
}
- cleanup = (flags & CLEANUP_MSG) ? COMMIT_MSG_CLEANUP_ALL :
- opts->default_msg_cleanup;
+ if (flags & CLEANUP_MSG)
+ cleanup = COMMIT_MSG_CLEANUP_ALL;
+ else if ((opts->signoff || opts->record_origin) &&
+ !opts->explicit_cleanup)
+ cleanup = COMMIT_MSG_CLEANUP_SPACE;
+ else
+ cleanup = opts->default_msg_cleanup;
if (cleanup != COMMIT_MSG_CLEANUP_NONE)
strbuf_stripspace(msg, cleanup == COMMIT_MSG_CLEANUP_ALL);