aboutsummaryrefslogtreecommitdiffstats
path: root/ref-filter.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-08-31 15:49:47 -0700
committerJunio C Hamano <gitster@pobox.com>2020-08-31 15:49:47 -0700
commite17723842b4fd42215ebf9c7ee5ab0bdfbe5a402 (patch)
tree3b969dd1f4f8c01e841600503d93d893f68f45f9 /ref-filter.c
parent63728e481451b8e218bec4d21ce085471d90fe7a (diff)
parent2c22e102f8cae598061be509344c6fdaf99c7db7 (diff)
downloadgit-e17723842b4fd42215ebf9c7ee5ab0bdfbe5a402.tar.gz
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.c8
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;