Commit 2150554b authored by Johannes Schindelin's avatar Johannes Schindelin Committed by Junio C Hamano

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's avatarJohannes Schindelin <[email protected]>
Signed-off-by: default avatarJunio C Hamano <[email protected]>
parent 13208572
......@@ -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);
......@@ -126,6 +126,7 @@ test_expect_success 'using alternate GIT_INDEX_FILE (2)' '
cat > expect << EOF
Signed-off-by: C O Mitter <[email protected]>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment