Skip to content

Commit 74a74be

Browse files
committed
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
2 parents 872e2cf + fd1062e commit 74a74be

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

mailinfo.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,8 +757,13 @@ static int handle_commit_msg(struct mailinfo *mi, struct strbuf *line)
757757
assert(!mi->filter_stage);
758758

759759
if (mi->header_stage) {
760-
if (!line->len || (line->len == 1 && line->buf[0] == '\n'))
760+
if (!line->len || (line->len == 1 && line->buf[0] == '\n')) {
761+
if (mi->inbody_header_accum.len) {
762+
flush_inbody_header_accum(mi);
763+
mi->header_stage = 0;
764+
}
761765
return 0;
766+
}
762767
}
763768

764769
if (mi->use_inbody_headers && mi->header_stage) {

t/t4150-am.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,9 @@ test_expect_success 'am works with multi-line in-body headers' '
983983
rm -fr .git/rebase-apply &&
984984
git checkout -f first &&
985985
echo one >> file &&
986-
git commit -am "$LONG" --author="$LONG <[email protected]>" &&
986+
git commit -am "$LONG
987+
988+
Body test" --author="$LONG <[email protected]>" &&
987989
git format-patch --stdout -1 >patch &&
988990
# bump from, date, and subject down to in-body header
989991
perl -lpe "
@@ -997,7 +999,7 @@ test_expect_success 'am works with multi-line in-body headers' '
997999
git am msg &&
9981000
# Ensure that the author and full message are present
9991001
git cat-file commit HEAD | grep "^author.*[email protected]" &&
1000-
git cat-file commit HEAD | grep "^$LONG"
1002+
git cat-file commit HEAD | grep "^$LONG$"
10011003
'
10021004

10031005
test_done

0 commit comments

Comments
 (0)