| 1360 | } |
| 1361 | |
| 1362 | void process_trailers(const struct process_trailer_options *opts, |
| 1363 | struct list_head *new_trailer_head, |
| 1364 | struct strbuf *input, struct strbuf *out) |
| 1365 | { |
| 1366 | LIST_HEAD(head); |
| 1367 | struct trailer_block *trailer_block; |
| 1368 | |
| 1369 | trailer_block = parse_trailers(opts, input->buf, &head); |
| 1370 | |
| 1371 | /* Print the lines before the trailer block */ |
| 1372 | if (!opts->only_trailers) |
| 1373 | strbuf_add(out, input->buf, trailer_block_start(trailer_block)); |
| 1374 | |
| 1375 | if (!opts->only_trailers && !blank_line_before_trailer_block(trailer_block)) |
| 1376 | strbuf_addch(out, '\n'); |
| 1377 | |
| 1378 | if (!opts->only_input) { |
| 1379 | LIST_HEAD(config_head); |
| 1380 | LIST_HEAD(arg_head); |
| 1381 | parse_trailers_from_config(&config_head); |
| 1382 | parse_trailers_from_command_line_args(&arg_head, new_trailer_head); |
| 1383 | list_splice(&config_head, &arg_head); |
| 1384 | process_trailers_lists(&head, &arg_head); |
| 1385 | } |
| 1386 | |
| 1387 | /* Print trailer block. */ |
| 1388 | format_trailers(opts, &head, out); |
| 1389 | free_trailers(&head); |
| 1390 | |
| 1391 | /* Print the lines after the trailer block as is. */ |
| 1392 | if (!opts->only_trailers) |
| 1393 | strbuf_add(out, input->buf + trailer_block_end(trailer_block), |
| 1394 | input->len - trailer_block_end(trailer_block)); |
| 1395 | trailer_block_release(trailer_block); |
| 1396 | } |
no test coverage detected