From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 445781F61A for ; Wed, 14 Dec 2022 16:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238960AbiLNQYH (ORCPT ); Wed, 14 Dec 2022 11:24:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238951AbiLNQYF (ORCPT ); Wed, 14 Dec 2022 11:24:05 -0500 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC12C21A9 for ; Wed, 14 Dec 2022 08:24:04 -0800 (PST) Received: (qmail 26040 invoked by uid 109); 14 Dec 2022 16:24:04 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Wed, 14 Dec 2022 16:24:04 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 19999 invoked by uid 111); 14 Dec 2022 16:24:04 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Wed, 14 Dec 2022 11:24:04 -0500 Authentication-Results: peff.net; auth=none Date: Wed, 14 Dec 2022 11:24:03 -0500 From: Jeff King To: git@vger.kernel.org Subject: [PATCH 5/5] ref-filter: convert email atom parser to use err_bad_arg() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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 --- ref-filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ref-filter.c b/ref-filter.c index f40bc4d9c9..733b0149e8 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -489,7 +489,7 @@ static int person_email_atom_parser(struct ref_format *format, struct used_atom else if (!strcmp(arg, "localpart")) atom->u.email_option.option = EO_LOCALPART; else - return strbuf_addf_ret(err, -1, _("unrecognized email option: %s"), arg); + return err_bad_arg(err, atom->name, arg); return 0; } -- 2.39.0.550.g5015380a67