Skip to content

Commit 2887103

Browse files
chriscoolgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent dfd66dd commit 2887103

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

trailer.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,10 @@ static int process_input_file(struct strbuf **lines,
804804

805805
/* Parse trailer lines */
806806
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+
}
809811
}
810812

811813
return patch_start;

0 commit comments

Comments
 (0)