travis-ci: printf $STATUS as string
[gitweb.git] / mailinfo.c
index 2fb3877ee44e9cdc83c43fa23971f02a94b5a49f..68037758f2f01be6edfab34b7871af68a17163eb 100644 (file)
@@ -710,7 +710,8 @@ static void flush_inbody_header_accum(struct mailinfo *mi)
 {
        if (!mi->inbody_header_accum.len)
                return;
-       assert(check_header(mi, &mi->inbody_header_accum, mi->s_hdr_data, 0));
+       if (!check_header(mi, &mi->inbody_header_accum, mi->s_hdr_data, 0))
+               die("BUG: inbody_header_accum, if not empty, must always contain a valid in-body header");
        strbuf_reset(&mi->inbody_header_accum);
 }
 
@@ -756,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) {