Skip to content

Commit 285da43

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Acked-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1955ef1 commit 285da43

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ref-filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static int person_email_atom_parser(struct ref_format *format, struct used_atom
489489
else if (!strcmp(arg, "localpart"))
490490
atom->u.email_option.option = EO_LOCALPART;
491491
else
492-
return strbuf_addf_ret(err, -1, _("unrecognized email option: %s"), arg);
492+
return err_bad_arg(err, atom->name, arg);
493493
return 0;
494494
}
495495

0 commit comments

Comments
 (0)