summaryrefslogtreecommitdiff
path: root/mailinfo.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-04-01 19:14:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-11 07:49:40 (GMT)
commitfd1062e52e1a7ed3be443a320708ed849958c1bf (patch)
tree3b80272b10bf546ef31dda81112acaea053d113e /mailinfo.c
parent4cff50b3fb50940e57dc10769b2f92d5cec1a05a (diff)
downloadgit-fd1062e52e1a7ed3be443a320708ed849958c1bf.zip
git-fd1062e52e1a7ed3be443a320708ed849958c1bf.tar.gz
git-fd1062e52e1a7ed3be443a320708ed849958c1bf.tar.bz2
mailinfo: fix in-body header continuations
An empty line should stop any pending in-body headers, and start the actual body parsing. This also modifies the original test for the in-body headers to actually have a real commit body that starts with spaces, and changes the test to check that the long line matches _exactly_, and doesn't get extra data from the body. Fixes:6b4b013f1884 ("mailinfo: handle in-body header continuations") Cc: Jonathan Tan <jonathantanmy@google.com> Cc: Jeff King <peff@peff.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mailinfo.c')
-rw-r--r--mailinfo.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mailinfo.c b/mailinfo.c
index 2275b28..1e4e283 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -674,8 +674,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) {