summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-03-21 21:02:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-03-21 21:02:37 (GMT)
commit54797b98b85cfe7e0e6ea1cbf314981456bd047e (patch)
treefdf064e48c5272dd3f860494441bfa84b9ded9c7 /builtin
parentf5715de54a2237025a74704cb41f5404c743a2c3 (diff)
parent46fbf7536404257a68fd4ea5d92a3bcb3f7b5848 (diff)
downloadgit-54797b98b85cfe7e0e6ea1cbf314981456bd047e.zip
git-54797b98b85cfe7e0e6ea1cbf314981456bd047e.tar.gz
git-54797b98b85cfe7e0e6ea1cbf314981456bd047e.tar.bz2
Merge branch 'bc/commit-complete-lines-given-via-m-option'
'git commit -m "$str"' when $str was already terminated with a LF now avoids adding an extra LF to the message. * 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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 3348aa1..d21d07a 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;
}