trailer: ignore comment lines inside the trailers

Otherwise trailers that are commented out might be processed. We would also error out if the comment line char is also a separator. This means that comments inside a trailer block will disappear, but that was already the case anyway. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Christian Couder committed Nov 9, 2014 at 10:23 UTC 2887103b35b3b40025ca5060713dfb1e1c8c3b20
1 file changed +4 -2
trailer.c
+4 -2
@@ -804,8 +804,10 @@ static int process_input_file(struct strbuf **lines,
804
805 /* Parse trailer lines */
806 for (i = trailer_start; i < patch_start; i++) {
807 - struct trailer_item *new = create_trailer_item(lines[i]->buf);
808 - add_trailer_item(in_tok_first, in_tok_last, new);
807 + if (lines[i]->buf[0] != comment_line_char) {
808 + struct trailer_item *new = create_trailer_item(lines[i]->buf);
809 + add_trailer_item(in_tok_first, in_tok_last, new);
810 + }
811 }
812
813 return patch_start;