summaryrefslogtreecommitdiff
path: root/builtin-commit.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-11-11 17:36:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-11-23 01:05:03 (GMT)
commit2150554b0ed60356d8918b610834c04ad2eecdec (patch)
tree0b330cf832aa6fadc8f49c38d9aa1ce5366b0424 /builtin-commit.c
parent13208572fbe8838fd8835548d7502202d1f7b21d (diff)
downloadgit-2150554b0ed60356d8918b610834c04ad2eecdec.zip
git-2150554b0ed60356d8918b610834c04ad2eecdec.tar.gz
git-2150554b0ed60356d8918b610834c04ad2eecdec.tar.bz2
builtin-commit --s: add a newline if the last line was not a S-o-b
The rule is this: if the last line already contains the sign off by the current committer, do nothing. If it contains another sign off, just add the sign off of the current committer. If the last line does not contain a sign off, add a new line before adding the sign off. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-commit.c')
-rw-r--r--builtin-commit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin-commit.c b/builtin-commit.c
index 780eec7..4dfa802 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -197,8 +197,11 @@ static int prepare_log_message(const char *index_file, const char *prefix)
for (i = sb.len - 1; i > 0 && sb.buf[i - 1] != '\n'; i--)
; /* do nothing */
- if (prefixcmp(sb.buf + i, sob.buf))
+ if (prefixcmp(sb.buf + i, sob.buf)) {
+ if (prefixcmp(sb.buf + i, sign_off_header))
+ strbuf_addch(&sb, '\n');
strbuf_addbuf(&sb, &sob);
+ }
strbuf_release(&sob);
}