diff options
author | Jeff King <peff@peff.net> | 2017-08-15 06:23:25 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-15 11:13:58 -0700 |
commit | fdbdb64f49959f9c83329554080934895f02ae59 (patch) | |
tree | ed63c6ef71dd06f61b3d2abe2f08a9f667de7381 /trailer.c | |
parent | 56c493ed1b9c067813fb95ff7cd4f69c7c1d2e36 (diff) | |
download | git-fdbdb64f49959f9c83329554080934895f02ae59.tar.gz |
interpret-trailers: add an option to show only existing trailers
It can be useful to invoke interpret-trailers for the
primary purpose of parsing existing trailers. But in that
case, we don't want to apply existing ifMissing or ifExists
rules from the config. Let's add a special mode where we
avoid applying those rules. Coupled with --only-trailers,
this gives us a reasonable parsing tool.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trailer.c')
-rw-r--r-- | trailer.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -976,7 +976,6 @@ void process_trailers(const char *file, struct string_list *trailers) { LIST_HEAD(head); - LIST_HEAD(arg_head); struct strbuf sb = STRBUF_INIT; int trailer_end; FILE *outfile = stdout; @@ -991,9 +990,11 @@ void process_trailers(const char *file, /* Print the lines before the trailers */ trailer_end = process_input_file(outfile, sb.buf, &head, opts); - process_command_line_args(&arg_head, trailers); - - process_trailers_lists(&head, &arg_head); + if (!opts->only_input) { + LIST_HEAD(arg_head); + process_command_line_args(&arg_head, trailers); + process_trailers_lists(&head, &arg_head); + } print_all(outfile, &head, opts); |