Merge branch 'lt/mailinfo-in-body-header-continuation'

If a patch e-mail had its first paragraph after an in-body header
indented (even after a blank line after the in-body header line),
the indented line was mistook as a continuation of the in-body
header.  This has been fixed.

* lt/mailinfo-in-body-header-continuation:
  mailinfo: fix in-body header continuations
This commit is contained in:
Junio C Hamano 2017-04-19 21:37:15 -07:00
commit 74a74beee9
2 changed files with 10 additions and 3 deletions

View File

@ -757,8 +757,13 @@ static int handle_commit_msg(struct mailinfo *mi, struct strbuf *line)
assert(!mi->filter_stage);
if (mi->header_stage) {
if (!line->len || (line->len == 1 && line->buf[0] == '\n'))
if (!line->len || (line->len == 1 && line->buf[0] == '\n')) {
if (mi->inbody_header_accum.len) {
flush_inbody_header_accum(mi);
mi->header_stage = 0;
}
return 0;
}
}
if (mi->use_inbody_headers && mi->header_stage) {

View File

@ -983,7 +983,9 @@ test_expect_success 'am works with multi-line in-body headers' '
rm -fr .git/rebase-apply &&
git checkout -f first &&
echo one >> file &&
git commit -am "$LONG" --author="$LONG <long@example.com>" &&
git commit -am "$LONG
Body test" --author="$LONG <long@example.com>" &&
git format-patch --stdout -1 >patch &&
# bump from, date, and subject down to in-body header
perl -lpe "
@ -997,7 +999,7 @@ test_expect_success 'am works with multi-line in-body headers' '
git am msg &&
# Ensure that the author and full message are present
git cat-file commit HEAD | grep "^author.*long@example.com" &&
git cat-file commit HEAD | grep "^$LONG"
git cat-file commit HEAD | grep "^$LONG$"
'
test_done