mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
Merge branch 'jc/commit-s-subject-is-not-a-footer'
* jc/commit-s-subject-is-not-a-footer: builtin-commit.c: fix logic to omit empty line before existing footers
This commit is contained in:
commit
6e31f3dbb5
|
@ -530,7 +530,7 @@ static int prepare_to_commit(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 (!ends_rfc2822_footer(&sb))
|
||||
if (!i || !ends_rfc2822_footer(&sb))
|
||||
strbuf_addch(&sb, '\n');
|
||||
strbuf_addbuf(&sb, &sob);
|
||||
}
|
||||
|
|
|
@ -258,4 +258,13 @@ test_expect_success 'Hand committing of a redundant merge removes dups' '
|
|||
|
||||
'
|
||||
|
||||
test_expect_success 'A single-liner subject with a token plus colon is not a footer' '
|
||||
|
||||
git reset --hard &&
|
||||
git commit -s -m "hello: kitty" --allow-empty &&
|
||||
git cat-file commit HEAD | sed -e "1,/^$/d" >actual &&
|
||||
test $(wc -l <actual) = 3
|
||||
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Loading…
Reference in a new issue