From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 984581F597 for ; Thu, 2 Aug 2018 15:59:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388113AbeHBRvL (ORCPT ); Thu, 2 Aug 2018 13:51:11 -0400 Received: from mout.web.de ([212.227.15.3]:51297 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387645AbeHBRvL (ORCPT ); Thu, 2 Aug 2018 13:51:11 -0400 Received: from [192.168.178.36] ([79.237.249.67]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LbroC-1gCrb9072C-00jG4m; Thu, 02 Aug 2018 17:59:19 +0200 Subject: Re: Re* [PATCH] push: comment on a funny unbalanced option help To: Junio C Hamano , =?UTF-8?B?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Cc: git@vger.kernel.org References: <87k1p9u860.fsf@evledraar.gmail.com> From: =?UTF-8?Q?Ren=c3=a9_Scharfe?= Message-ID: Date: Thu, 2 Aug 2018 17:59:18 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:gTiO123/+XPZBv9C9hPHefvbr+T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I5 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Am 02.08.2018 um 17:44 schrieb Junio C Hamano: > Subject: [PATCH] push: use PARSE_OPT_LITERAL_ARGHELP instead of unbalanced brackets > From: Ævar Arnfjörð Bjarmason > Date: Thu, 02 Aug 2018 00:31:33 +0200 > > The option help text for the force-with-lease option to "git push" > reads like this: > > $ git push -h 2>&1 | grep -e force-with-lease > --force-with-lease[=:] > > which comes from having N_("refname>: text in the source code, with an aparent lack of "<" and ">" at both > ends. > > It turns out that parse-options machinery takes the whole string and > encloses it inside a pair of "<>", to make it easier for majority > cases that uses a single token placeholder. > > The help string was written in a funnily unbalanced way knowing that > the end result would balance out, by somebody who forgot the > presence of PARSE_OPT_LITERAL_ARGHELP, which is the escape hatch > mechanism designed to help such a case. We just should use the > official escape hatch instead. > > Helped-by: René Scharfe I didn't do anything for this particular patch so far? But... > Signed-off-by: Junio C Hamano > --- > builtin/push.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/builtin/push.c b/builtin/push.c > index 1c28427d82..ef4032a9ef 100644 > --- a/builtin/push.c > +++ b/builtin/push.c > @@ -542,9 +542,9 @@ int cmd_push(int argc, const char **argv, const char *prefix) > OPT_BIT( 0, "porcelain", &flags, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN), > OPT_BIT('f', "force", &flags, N_("force updates"), TRANSPORT_PUSH_FORCE), > { OPTION_CALLBACK, > - 0, CAS_OPT_NAME, &cas, N_("refname>: + 0, CAS_OPT_NAME, &cas, N_(":"), ... shouldn't we use this opportunity to document that "expect" is optional? + 0, CAS_OPT_NAME, &cas, N_("[:]"), > N_("require old value of ref to be at this value"), > - PARSE_OPT_OPTARG, parseopt_push_cas_option }, > + PARSE_OPT_OPTARG | PARSE_OPT_LITERAL_ARGHELP, parseopt_push_cas_option }, > { OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules, "check|on-demand|no", > N_("control recursive pushing of submodules"), > PARSE_OPT_OPTARG, option_parse_recurse_submodules }, >