diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-09-01 01:49:47 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-09-01 01:49:47 +0300 |
commit | e17723842b4fd42215ebf9c7ee5ab0bdfbe5a402 (patch) | |
tree | 3b969dd1f4f8c01e841600503d93d893f68f45f9 /ref-filter.c | |
parent | 63728e481451b8e218bec4d21ce085471d90fe7a (diff) | |
parent | 2c22e102f8cae598061be509344c6fdaf99c7db7 (diff) |
Merge branch 'hv/ref-filter-trailers-atom-parsing-fix'
The parser for "git for-each-ref --format=..." was too loose when
parsing the "%(trailers...)" atom, and forgot that "trailers" and
"trailers:<modifiers>" are the only two allowed forms, which has
been corrected.
* hv/ref-filter-trailers-atom-parsing-fix:
ref-filter: 'contents:trailers' show error if `:` is missing
t6300: unify %(trailers) and %(contents:trailers) tests
Diffstat (limited to 'ref-filter.c')
-rw-r--r-- | ref-filter.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ref-filter.c b/ref-filter.c index ba85869755..8ba0e31915 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -345,9 +345,11 @@ static int contents_atom_parser(const struct ref_format *format, struct used_ato atom->u.contents.option = C_SIG; else if (!strcmp(arg, "subject")) atom->u.contents.option = C_SUB; - else if (skip_prefix(arg, "trailers", &arg)) { - skip_prefix(arg, ":", &arg); - if (trailers_atom_parser(format, atom, *arg ? arg : NULL, err)) + else if (!strcmp(arg, "trailers")) { + if (trailers_atom_parser(format, atom, NULL, err)) + return -1; + } else if (skip_prefix(arg, "trailers:", &arg)) { + if (trailers_atom_parser(format, atom, arg, err)) return -1; } else if (skip_prefix(arg, "lines=", &arg)) { atom->u.contents.option = C_LINES; |