diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-04-03 09:26:07 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-03 09:26:07 -0700 |
commit | 14c79b1faa113707d8955912af6064d9844f71eb (patch) | |
tree | 0072f315d261bf4c4792ddcba45445facab1e0d1 /builtin | |
parent | 295e3938fc2e0a229958e2fb76eb8b66fcb3611d (diff) | |
parent | 46fbf7536404257a68fd4ea5d92a3bcb3f7b5848 (diff) | |
download | git-14c79b1faa113707d8955912af6064d9844f71eb.tar.gz |
Merge branch 'bc/commit-complete-lines-given-via-m-option' into maint
'git commit -m "$msg"' used to add an extra newline even when
$msg already ended with one.
* bc/commit-complete-lines-given-via-m-option:
Documentation/git-commit.txt: rework the --cleanup section
git-commit: only append a newline to -m mesg if necessary
t7502: demonstrate breakage with a commit message with trailing newlines
t/t7502: compare entire commit message with what was expected
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/commit.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/commit.c b/builtin/commit.c index 3348aa14e9..d21d07a1a8 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -124,8 +124,10 @@ static int opt_parse_m(const struct option *opt, const char *arg, int unset) if (unset) strbuf_setlen(buf, 0); else { + if (buf->len) + strbuf_addch(buf, '\n'); strbuf_addstr(buf, arg); - strbuf_addstr(buf, "\n\n"); + strbuf_complete_line(buf); } return 0; } |