]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.c
ref-filter: convert email atom parser to use err_bad_arg()
authorJeff King <peff@peff.net>
Wed, 14 Dec 2022 16:24:03 +0000 (11:24 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Dec 2022 00:14:09 +0000 (09:14 +0900)
commit285da4321a9351d4c99dd1685a4aa2dfb47ff62e
tree87ac219b863d2852a9ed3f923f52ef322b9254dd
parent1955ef10edf3c888dcb237728c81dd6e81df4960
ref-filter: convert email atom parser to use err_bad_arg()

The error message for a bogus argument to %(authoremail), etc, is:

   $ git for-each-ref --format='%(authoremail:foo)'
   fatal: unrecognized email option: foo

Saying just "email" is a little vague; most of the other atom parsers
would use the full name "%(authoremail)", but we can't do that here
because the same function also handles %(taggeremail), etc. Until
recently, passing atom->name was a bad idea, because it erroneously
included the arguments in the atom name. But since the previous commit
taught err_bad_arg() to handle this, we can now do so and get:

  fatal: unrecognized %(authoremail) argument: foo

which is consistent with other atoms.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c