From patchwork Mon Jul 24 12:34:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 13324565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DED63C0015E for ; Mon, 24 Jul 2023 12:34:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229608AbjGXMer (ORCPT ); Mon, 24 Jul 2023 08:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjGXMeq (ORCPT ); Mon, 24 Jul 2023 08:34:46 -0400 Received: from mout.web.de (mout.web.de [212.227.15.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4198E66 for ; Mon, 24 Jul 2023 05:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1690202079; x=1690806879; i=l.s.r@web.de; bh=k6v4gvXR0gGDlIXmis3AUbBW039nh4y/TI6Isi8pHTE=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References:In-Reply-To; b=WdC7h6QJaNJ/WFEW5EpUYSqpRq/AtUo7lbWbrc7bVdWpKcuOB/qKH8KL0oN9J7RrPvFLjca cpsQRk12ebtwKMfk37283JusIkFgLKBTW0DR84bnrhc3RehPus4PUss0tZgMxmlHYNUJ7Wj3Q H4qxtak24tbgBKgGtL2m2luHx3PEfjSnY+on8bJiOZFVL2OCG9D3W5Phd2m5MLV0Wv7BA50XR nMjojHpVz0s30C+XUH75LzUiVOTd9Wh8eBHmGMiSX8+0XkzvmFMoOwGrBvWmCx8jRfhwDG1+2 AnWQLLXKRW75TBYLuCa6fsGGwRN7VsHGUlQxx3v1eabJYTBTilkQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.29] ([91.47.150.179]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1M9Zdw-1qIQaQ3mMO-005rmm; Mon, 24 Jul 2023 14:34:38 +0200 Message-ID: <2cfa6142-8acc-eb35-bf69-ede986202435@web.de> Date: Mon, 24 Jul 2023 14:34:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 1/5] subtree: disallow --no-{help,quiet,debug,branch,message} Content-Language: en-US From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: Git List Cc: Junio C Hamano References: <43ca3f01-ba11-6c29-a8e8-4e6c262a68cc@web.de> <4d01e971-07cb-4f11-3cc6-9d9f21e590c1@web.de> In-Reply-To: <4d01e971-07cb-4f11-3cc6-9d9f21e590c1@web.de> X-Provags-ID: V03:K1:hGMS4Q+VbRmW5xAPuZIlm3F8GkVxY0n823C4fLXNNV/aiEDgSYG rG4u39niB9118vflWl+Lf++HDtoX4L1MR4l4hCYz9d2Yw03+/9XJQ6mfkRGqW29INpuTAZN jQ7v0gwd9WE8dW48mFgRNxZqJ1P9Y5q0vS8xlO8AMCRKclWM6vvpwOEFvzBTCA9ONY947pq YWkCf1DuVMSq2gAI45KNA== UI-OutboundReport: notjunk:1;M01:P0:7plKJT3xV54=;si6qmh1EQ5FRDriCUhGj+NtfYYK 2IxbCV90GBkmVs/nwnJ4RM8eJk75jVO9slwO8QKY52J0sRSev1aWna1kL2TXR9nm/07RxmS3E zXx3sTP/oYh1f52W6nhXiYzY8P7LzsMGtW/1G2tb9m4zzRqEn2CM401ps0TEyDzePWkGsRE8t Zm8yDFBZzMyjsBQ5oKgRJ+59MvPWYqU1uxJKcc/i4BQ5q+u8EhstKPbFBSG0Ebk7gZM+HsH7u Xe6jSuHF0uug02aU6rMa5lgwpm5VoiPHa1ucytMz/EK5Uaq/Mn12LIM0vFu2iK1vq+tQnHXAR cRepSN2kF+OQ/fPzYUzf0V16CaZ5TbjPYekjEXARbKxz8uaYJIPPe+14taFou0qiTdzA62X8F gUeHmtg52ow8b1tGXvKFhxqGlqUNfFPxD4KhXtfwOeDP+IqFme+K3YZb/4TxHf9Yz6sAtk1yX rdLJuUT0+HL+fJ4fXfZU9s6qXLMl1KQjndAQiCjFdqTLASMCd8DiUNpI1fGEuSereBrolxc/1 M/mcwe7XH0rt4bMWjZDyoyUwQ2HZFtl1yhwS/axUBAoq8T7bgv8GKuqf6ZLGWporxFI7Xburm y1R3gjA+FutyhKM5UZhcppQ1HAay0cP1wqWsFy8WqrQG8iOP2nmlYuPCwDbY2RvXWmN0yt7wr VFBLFoXdafibicx+CTfBKKzH0O2j2o2vWARch9Qrz/b+Bv/T5zUg2ZX9XA0/Ere7FPBaDzygF G5sm/CwIn+ei4CfdtrPiaBNMXFCKlFCeL8Qg2PJOv+NYIHp8uSJvKlYPwJsZAPzyCV31HGeHG r0n9IeTtWORxvVPTG8yLLsAubs3wvDrKXC7gM8k8/RAJb7FAEZHXa6nniK+Jp1bkk0xp08Fyh TfKW1MuHh/5+g+PhSkbIaeNOWSTU2Bo4K2S+2Duq7DPb5u0ga5ZydEXUJ/ebFYwLwMUcGobWp XvPRyg== Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org "git subtree" only handles the negated variant of the options annotate, prefix, onto, rejoin, ignore-joins and squash explicitly. help is handled by "git rev-parse --parseopt" implicitly, but not its negated form. Disable negation for it and the for the rest of the options to get a helpful error message when trying them. Signed-off-by: René Scharfe --- contrib/subtree/git-subtree.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.41.0 diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh index 7db4c45676..e0c5d3b0de 100755 --- a/contrib/subtree/git-subtree.sh +++ b/contrib/subtree/git-subtree.sh @@ -33,19 +33,19 @@ git subtree split --prefix= [] git subtree pull --prefix= git subtree push --prefix= -- -h,help show the help -q,quiet quiet -d,debug show debug messages +h,help! show the help +q,quiet! quiet +d,debug! show debug messages P,prefix= the name of the subdir to split out options for 'split' (also: 'push') annotate= add a prefix to commit message of new commits -b,branch= create a new branch from the split subtree +b,branch!= create a new branch from the split subtree ignore-joins ignore prior --rejoin commits onto= try connecting new tree to an existing one rejoin merge the new branch back into HEAD options for 'add' and 'merge' (also: 'pull', 'split --rejoin', and 'push --rejoin') squash merge subtree changes as a single commit -m,message= use the given message as the commit message for the merge commit +m,message!= use the given message as the commit message for the merge commit " indent=0 From patchwork Mon Jul 24 12:36:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 13324566 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4711C0015E for ; Mon, 24 Jul 2023 12:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230141AbjGXMgx (ORCPT ); Mon, 24 Jul 2023 08:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230007AbjGXMgv (ORCPT ); Mon, 24 Jul 2023 08:36:51 -0400 Received: from mout.web.de (mout.web.de [212.227.15.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9462E66 for ; Mon, 24 Jul 2023 05:36:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1690202206; x=1690807006; i=l.s.r@web.de; bh=t6rwo/FTqmHCsxWuRvsK8g19w6YwkG7IMlY2RSTmCLg=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References:In-Reply-To; b=Dp3TC4kpK0sgwmgGs83za7Z5yR1GzjYBsswqkVwKJiPFW3eZ3H5v7d/vrN82srEIGif5Y8a fGNDpWEI9GXV/BaQoas8PjlfWbBAKtRqyMXErUPn9vgzeuyR4XkI7U8dET9RYYXvHgRcmQh9y zU9q4DLVs9eAOSBL433urCFUBdsNMXGbgbbeg9cbaJF+oRWwOXMrpkoCEl8MkcpP2EHlaEM1x ooScMPcIyuhPNTWZ9IOuPav9rijW52N+kx+B9u9/GgjaNdfkjBpqYYECIGwXagY7EpjkZhEUV d0teyLWTwtTK5vP78q4pWmlgb3LrluFtPIP3qyIwa/pNVus7ZBvA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.29] ([91.47.150.179]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1M5Qq9-1qN5zP0sg1-001dgS; Mon, 24 Jul 2023 14:36:46 +0200 Message-ID: <472f65b4-76a1-619f-269e-e8edf8f60463@web.de> Date: Mon, 24 Jul 2023 14:36:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 2/5] t1502, docs: disallow --no-help Content-Language: en-US From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: Git List Cc: Junio C Hamano References: <43ca3f01-ba11-6c29-a8e8-4e6c262a68cc@web.de> <4d01e971-07cb-4f11-3cc6-9d9f21e590c1@web.de> In-Reply-To: <4d01e971-07cb-4f11-3cc6-9d9f21e590c1@web.de> X-Provags-ID: V03:K1:fH8DpACoszHsFIKMkaHenr8GnkH1T94afRA+2i9k7BgRrwJ+Dvw irKdZSWOZJTHJFPuzM1DeEyq9q0Ok3IHe+9AfgtZX82U71WH5iQzfZn3zrtIoyOSEkdWa8I s/7DzyIR2rD8n36KSnD6uo7Mltkq3y6FzSepVtQKBX2FmUWYrliE2X4R2J9riFe5or/ZVi2 E8qQRbDNBCJSwAmSaL9IQ== UI-OutboundReport: notjunk:1;M01:P0:Vkxb6p7PG+U=;s5P9Ktg0QmiIWDln/ISg06jcNt8 0N+wSCL+otc6ulhf9zSwslEIkXLtLgg4MyPXET/F1dWelTxLIb9GdYLedO8xF+MSGVGu7IfRo t2lxCOI5t9HlPtQVXx8nGYlhvNJCnJ7+knU9jaWQZbni+uRMcIU3jApM8ur+N0PX2ZSnRCWz3 R9gvfsI0UiT3uVuq8ept+sxFTm0kTWMU5oh+xQX6Gor3zt+Qfko15Q7lfzmocAyxLV2PSO5sW VKK+Dc+SzPzz6a3Chmgc7ppaLvlZTTZ3SsQ1mSAL9QKFhGC85RX70WtmnvEJgE5HDXXz9vVfF ysO4JNpi0v6UBE0K8T4yye/F+gaJLCE0YZfxM1UdMkcrScNeiI7LNZO+gdYNR+MizJk9HUvck GT43Uw1PxJBkXfAoiP6wPuEaPZ+uiqqueGengGk3OA56P8VXyZYh4BiEX/Hxv0s9ZR035x/Id bh7JYSRVC463n+13io6YsvTkm2rlFSf4THcZHtKZCS5ZJgJkWnJAN9eWxHwoMhwnTt5vIZkI6 S/E8iaXBnxfQJ6WIfFLl+CEbsbgLGDwSgmzYNChxAqFEHH60vLuX+GINscx6BziXupK2rNJ3M 9EZYK2tHmqkL/CuEPIEMHqfr40uMFM6vV61K2ReGN8nfeLHJviVNdS+pG8kFId3h3FI5KLyxy 6YaMVjjoglb2np1e15+gsNjHc7UjmY0TtlTwRXHdjihBGjzzQW3oVwledRMF87X5H/J2j6xjh 5Gb6RYBsWeGC337OZ/nzU0sKNxX89tePNrPQTS/XuLz3K3qUfinj4MCqiNk36mQUrP27xvwdX grpZPFfr+aJAxEJmRIdvnpXHOfDz3OGvC+xKbExcafw7anBf3w4rv9g6EcWvVgBxSpikLqL7N UMOUb2HHpdl254ERrGXr7ooVo98laciH9LoilSngU1k1c65aeRUHw/7lEgnLGoM8ianLssXCq hyH93A== Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org "git rev-parse --parseopt" handles the built-in options -h and --help, but not --no-help. Make test definitions and documentation examples more realistic by disabling negation using the flag "!". Signed-off-by: René Scharfe --- Documentation/git-rev-parse.txt | 2 +- t/t1502-rev-parse-parseopt.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) -- 2.41.0 diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index f26a7591e3..6e8ff9ace1 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -398,7 +398,7 @@ some-command [] ... some-command does foo and bar! -- -h,help show the help +h,help! show the help foo some nifty option --foo bar= some cool option --bar with an argument diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh index dd811b7fb4..0cdc6eb8b3 100755 --- a/t/t1502-rev-parse-parseopt.sh +++ b/t/t1502-rev-parse-parseopt.sh @@ -9,7 +9,7 @@ test_expect_success 'setup optionspec' ' | |some-command does foo and bar! |-- -|h,help show the help +|h,help! show the help | |foo some nifty option --foo |bar= some cool option --bar with an argument @@ -288,7 +288,7 @@ test_expect_success 'test --parseopt help output: "wrapped" options normal "or:" | [--another-option] |cmd [--yet-another-option] |-- - |h,help show the help + |h,help! show the help EOF sed -e "s/^|//" >expect <<-\END_EXPECT && @@ -322,7 +322,7 @@ test_expect_success 'test --parseopt help output: multi-line blurb after empty l |line |blurb |-- - |h,help show the help + |h,help! show the help EOF sed -e "s/^|//" >expect <<-\END_EXPECT && From patchwork Mon Jul 24 12:38:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 13324567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E9AFC0015E for ; Mon, 24 Jul 2023 12:38:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230195AbjGXMio (ORCPT ); Mon, 24 Jul 2023 08:38:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbjGXMin (ORCPT ); Mon, 24 Jul 2023 08:38:43 -0400 Received: from mout.web.de (mout.web.de [212.227.15.4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1087E4E for ; Mon, 24 Jul 2023 05:38:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1690202318; x=1690807118; i=l.s.r@web.de; bh=KeMwsfXHsn+Xwmw/6VQTFU072VTn8A2xSW6+bP2utws=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References:In-Reply-To; b=ZmGR55Jh2go6MrvGMDHN8YkyKTt9Nb5NedSm0gMbBkbdCgh4utBTA53NAeLc27aoJD3HsSD 15Cq9BpOINqP9n7X+SdivRPNIIgW4UQTvVdXpjitLO7PuKtdXMiklwiVuw9Em0+tbZriPNXl9 gnIfuZFSput6nuA89ee3J90RE6SDQxuZ+GD0RtmgiZsyhuU65fquW6qD2Am63FQHTI/ePbhIL CQ3c4ihLugTOP3Wc3E5PsdLvfMBG93Vlf8rylokagq2fK4K2Z7oJcmgZ2XS+kTCYeXM0++BVj gd1T9NSZHVlty6GuYOr3fw5SAa3F4n4/HbP9keePqeU0a3B0Wc2Q== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.29] ([91.47.150.179]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MVJNT-1qVFDV2B5L-00S5Xx; Mon, 24 Jul 2023 14:38:38 +0200 Message-ID: Date: Mon, 24 Jul 2023 14:38:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 3/5] t1502: move optionspec help output to a file Content-Language: en-US From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: Git List Cc: Junio C Hamano References: <43ca3f01-ba11-6c29-a8e8-4e6c262a68cc@web.de> <4d01e971-07cb-4f11-3cc6-9d9f21e590c1@web.de> In-Reply-To: <4d01e971-07cb-4f11-3cc6-9d9f21e590c1@web.de> X-Provags-ID: V03:K1:lkce4Bs7vXB6DlniU1ClNGHr6bEyRJtQZAE/ASrYRlj9X2qx5VD DpguNYHv4kctq8UcBtnW8Oxo5zs2V1IJYxX2D/LfH6j7WrugpuZr+CduuZMIy6YRSxDrg9P NffY4HVklcPzJKvSxLL3tyYSauQfuIxaL4nVXdjZi2d/QnfelEloJ6IBzqubscp85hDH668 CNZF6HLLFonTeHxV1KYJQ== UI-OutboundReport: notjunk:1;M01:P0:b3KnM48c8bw=;bBZP48BgUw3K/fu7o24/g1CZW+u 970bN/1XoRLrYwYsGgw5x1FAQaR0LwOqWL6dMtIosFWi/Tv5vnEtJ1jWqEE5+89BhvbpvQKIJ BjjOwinMsGRD5dW2tWWjQBxoMnPqIRbmC4NsJ++kIkpK1NiCSHkr+g2Bx51QHqY855XW7jGJh yBGCFOL8e/QBP9zOy6vlaBrZp88BHKJwAT70moB7HTsJ0mTmRBZM25rG+kbXSI6sU/jczNDjd 2nKpbOM6Tkf33E6c9pi5BOtUP5/apFnsF9yCj86RdUCLwaA4swh8ADAZQ2gHlDJi8K849/Wyk HUvzSkBQMy/8/WfMdmL+A6Sdsk7abqJBBp16bPBPpj466nzqAIMEd8h16zI1ubHCw31LXd0By vXRvAU6co31dKigGK09VdUksTsvX9cMjmNjHvc4Pn3Jk/0BSigR5e5AHpzaY7rwjYM0GRsOWh dthBR7ZLQJ3FCAJGm3R27+kfqRftO17AK4UPKMFrrldLbQh2xzQBUb+N9cn/2WXgVKpqJ5f7M GdvORcIEQk99MKeVvBbsCCZR8uXF3XkYzlXjofCEXFNYWLjYITLZ8yuitiq0pKE5y0MWX7mdZ KtMuKoEikPZoZzcgPueB1PNpZ3tJlehmFsGwFygB6dkcvMgPX3X/7hDS23YY3y4LZPJjCmzLp GdKGMy/Ki7COvGix8EzsA23L8b7kLnhzjQRmwPEB7KO/47jMKouviec50E/tiBy2DMkaV68PE Ah6cKVZ35lD3ai7jRInMl/9KvkxCwzmaf+AycXdfEcaexLOGqJKiO9QsVu47Xm0OrYi2W5xX6 eKuqtPAIhR9OjuyjcgHKEh8G9G4k9FgoYZi1fO6XMqUVOz1HEOX98WuZapJ0eG2lr3qA5N0Ej x50Qw85hKzviQHZg1jn6aKmMSU6sqdXh4bzqGX7Ocv3l5eNeD5rgMEqxhEKzJD8k3jlVcodbJ t3W1Ig== Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org "git rev-parse --parseopt" shows the short help with its description of all recognized options twice: When called with -h or --help, and after reporting an unknown option. Move the one for optionspec into a file and use it in two tests to deduplicate that part. "git rev-parse --parseopt -- --h" wraps the help text in "cat <<\EOF" and "EOF". Keep that part in the file to use it as is in the test that needs it and simply remove it in the other one using sed. Disable whitespace checking for the file using an attribute, as we need to keep its spaces intact and wouldn't want a stray --whitespace=fix to turn them into tabs. Signed-off-by: René Scharfe --- t/t1502-rev-parse-parseopt.sh | 79 ++++------------------------------- t/t1502/.gitattributes | 1 + t/t1502/optionspec.help | 34 +++++++++++++++ 3 files changed, 42 insertions(+), 72 deletions(-) create mode 100644 t/t1502/.gitattributes create mode 100755 t/t1502/optionspec.help -- 2.41.0 diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh index 0cdc6eb8b3..813ee5872f 100755 --- a/t/t1502-rev-parse-parseopt.sh +++ b/t/t1502-rev-parse-parseopt.sh @@ -58,44 +58,8 @@ EOF ' test_expect_success 'test --parseopt help output' ' - sed -e "s/^|//" >expect <<\END_EXPECT && -|cat <<\EOF -|usage: some-command [options] ... -| -| some-command does foo and bar! -| -| -h, --help show the help -| --foo some nifty option --foo -| --bar ... some cool option --bar with an argument -| -b, --baz a short and long option -| -|An option group Header -| -C[...] option C with an optional argument -| -d, --data[=...] short and long option with an optional argument -| -|Argument hints -| -B short option required argument -| --bar2 long option required argument -| -e, --fuz -| short and long option required argument -| -s[] short option optional argument -| --long[=] long option optional argument -| -g, --fluf[=] short and long option optional argument -| --longest -| a very long argument hint -| --pair with an equals sign in the hint -| --aswitch help te=t contains? fl*g characters!` -| --bswitch hint has trailing tab character -| --cswitch switch has trailing tab character -| --short-hint with a one symbol hint -| -|Extras -| --extra1 line above used to cause a segfault but no longer does -| -|EOF -END_EXPECT test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec && - test_cmp expect output + test_cmp "$TEST_DIRECTORY/t1502/optionspec.help" output ' test_expect_success 'test --parseopt help output no switches' ' @@ -140,41 +104,12 @@ END_EXPECT ' test_expect_success 'test --parseopt invalid switch help output' ' - sed -e "s/^|//" >expect <<\END_EXPECT && -|error: unknown option `does-not-exist'\'' -|usage: some-command [options] ... -| -| some-command does foo and bar! -| -| -h, --help show the help -| --foo some nifty option --foo -| --bar ... some cool option --bar with an argument -| -b, --baz a short and long option -| -|An option group Header -| -C[...] option C with an optional argument -| -d, --data[=...] short and long option with an optional argument -| -|Argument hints -| -B short option required argument -| --bar2 long option required argument -| -e, --fuz -| short and long option required argument -| -s[] short option optional argument -| --long[=] long option optional argument -| -g, --fluf[=] short and long option optional argument -| --longest -| a very long argument hint -| --pair with an equals sign in the hint -| --aswitch help te=t contains? fl*g characters!` -| --bswitch hint has trailing tab character -| --cswitch switch has trailing tab character -| --short-hint with a one symbol hint -| -|Extras -| --extra1 line above used to cause a segfault but no longer does -| -END_EXPECT + { + cat <<-\EOF && + error: unknown option `does-not-exist'\'' + EOF + sed -e 1d -e \$d <"$TEST_DIRECTORY/t1502/optionspec.help" + } >expect && test_expect_code 129 git rev-parse --parseopt -- --does-not-exist 1>/dev/null 2>output < optionspec && test_cmp expect output ' diff --git a/t/t1502/.gitattributes b/t/t1502/.gitattributes new file mode 100644 index 0000000000..562b12e16e --- /dev/null +++ b/t/t1502/.gitattributes @@ -0,0 +1 @@ +* -whitespace diff --git a/t/t1502/optionspec.help b/t/t1502/optionspec.help new file mode 100755 index 0000000000..844eac6704 --- /dev/null +++ b/t/t1502/optionspec.help @@ -0,0 +1,34 @@ +cat <<\EOF +usage: some-command [options] ... + + some-command does foo and bar! + + -h, --help show the help + --foo some nifty option --foo + --bar ... some cool option --bar with an argument + -b, --baz a short and long option + +An option group Header + -C[...] option C with an optional argument + -d, --data[=...] short and long option with an optional argument + +Argument hints + -B short option required argument + --bar2 long option required argument + -e, --fuz + short and long option required argument + -s[] short option optional argument + --long[=] long option optional argument + -g, --fluf[=] short and long option optional argument + --longest + a very long argument hint + --pair with an equals sign in the hint + --aswitch help te=t contains? fl*g characters!` + --bswitch hint has trailing tab character + --cswitch switch has trailing tab character + --short-hint with a one symbol hint + +Extras + --extra1 line above used to cause a segfault but no longer does + +EOF From patchwork Mon Jul 24 12:39:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 13324568 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C975DC0015E for ; Mon, 24 Jul 2023 12:39:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229926AbjGXMjs (ORCPT ); Mon, 24 Jul 2023 08:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbjGXMjr (ORCPT ); Mon, 24 Jul 2023 08:39:47 -0400 Received: from mout.web.de (mout.web.de [212.227.15.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9C0E1B8 for ; Mon, 24 Jul 2023 05:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1690202382; x=1690807182; i=l.s.r@web.de; bh=g5rSZ3b5ed+9YyDCQf/y3FXW13mLRlS4L3+hPruXifc=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References:In-Reply-To; b=Nj13XDLkZfB4AY7m3CSkPfiTNT69pHHvn9HN341HLS2oQvJ5puBiqygGs/y1QI/N/jiqkE9 /N4F0pakLIRWsyYlzIQXmAo4RTSajLOxJZjGI7hXD8vN5BTK62/K565RonE2jvJYs/9TGmKSY pkkdj/wVbeS6nhqixV/CNQ8RK6bZGAdy0bpOqn9c3s9z1uEVQYEJfB86BzQQsZRqIqYTCNL3t bjTGOApB+ek9HlixcZpbs8qRx9w3PV5poAp9s3kmrXHWXihoNmmyn/p8Mscue1O1E8cXqUgZI RHPszgU75sQkfKT2aYIOjNYibLXI5g5f/WeCo3OqWsawYQ1aWSTA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.29] ([91.47.150.179]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MVJNT-1qVF8L15Hz-00S5Xv; Mon, 24 Jul 2023 14:39:42 +0200 Message-ID: <831cfa35-8c83-cd24-4348-c9c3769643c7@web.de> Date: Mon, 24 Jul 2023 14:39:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 4/5] t1502: test option negation Content-Language: en-US From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: Git List Cc: Junio C Hamano References: <43ca3f01-ba11-6c29-a8e8-4e6c262a68cc@web.de> <4d01e971-07cb-4f11-3cc6-9d9f21e590c1@web.de> In-Reply-To: <4d01e971-07cb-4f11-3cc6-9d9f21e590c1@web.de> X-Provags-ID: V03:K1:WHgstp/Ge/T+MN3m4jtF6+3VSRZWM0YNwwZaiMTYlWUrZ04rITx WLOFHgjjz7XFjwur8C1rFOKHeOBG68ZUAieBQAtWgiPQHfgT/Hu2ZPQjsTxQ5lXp7rciYGb nJyizPdp6zEcDPJ/PQaCxBgTs0HLGRBxNG9FZ+1MmRpOX10PzBnBEyFBa/3g3PXVzEo+HOW EV5SUmVsUHmDJmvsFtlMA== UI-OutboundReport: notjunk:1;M01:P0:TrJgqPmSby4=;m5HWiVU8bh31/103H4/B+ScOrVB pUElTmXtis53KdUqD+KNhEweV4YnR9Faf/PMPiTBmCYjJrGqA0+UvLJpjMCl/T45Z913pThg+ tGh7hWgtedG01/frCKpeXpPi9IjCcZI0MfSeiCh6szNENX+e5tn+4/DVjk/9VbZw3bi81OC/g EJTg42zvcVYh8yF/Oq1B12uo3p/7jL/a09LfhcFzWn3bl8R3vQEgSVzzUv4VSJaerV80eLo8j uUhd3mFTZC1i4LtagY2F/dI+aepjBhZd/rNtNGWIY99ou//UQAL6fVlY4gnmbOaB4bmZq/n3K rMmMcVcME07uQKRiHQv+tLjjTFos0JjLuZHya7ywkG6K6C33nLUeUe+cjN0YpS58j5jsg600V 5StDM6+UHxu7Wx1WeZPnn9wa0zJeaPNKO/cSwsV9uv6iXezmfloIoodMnwSREVC0xYwB1dieS gOhrnuhEEydtHENdnoZ/dqKyLy8g/48oQaqeLrFRDAJ2pVaLZZujUQH9p5/iyfviLVoZ2D4dc 6VvkRqp3XzLPAIRQ8f8j7NJOsA+2jg2RxRHi7IaT/jiT25DAywO7/pyUBfveke/E5QZgTENiH T8m51HdvRwXlYQvET7VK2FdDFCSF1jMtUp9QH6KfkhK3PXoinrlChbdUwVtDmnOYqukExN0BO C8M9vQwFm8H5QJ589btIdKPaF4wYC6J3KV9D9JpMhqPQHI6Md9QnTSbjQNd5sZYJIJWQIdJ5g 7ZxUInGiKC6B38G1it6ZBWk5s/kwG705g3POh5nuH6OniCk/2xixTj64ZQ4Dwvz7TPCP6sbBZ v8PV1cbS+pgf1CrWiGun9/10vJVKDQzMoyOH42cO483vsepa9QzXJNboAIB69W1EmuVif1gp9 i0Qj309B/AD8YYjz7qlyJH8t+6Loic59B+i87ryfbs7IiwfEh/foFJU3rY1xaihju6QjsWzBq qhpGMg== Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add tests for checking the "git rev-parse --parseopt" flag "!" and whether options can be negated with a "no-" prefix. Signed-off-by: René Scharfe --- t/t1502-rev-parse-parseopt.sh | 44 +++++++++++++++++++++++++++++++++++ t/t1502/optionspec-neg | 8 +++++++ t/t1502/optionspec-neg.help | 11 +++++++++ 3 files changed, 63 insertions(+) create mode 100644 t/t1502/optionspec-neg create mode 100644 t/t1502/optionspec-neg.help -- 2.41.0 diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh index 813ee5872f..0f7c2db4c0 100755 --- a/t/t1502-rev-parse-parseopt.sh +++ b/t/t1502-rev-parse-parseopt.sh @@ -3,6 +3,22 @@ test_description='test git rev-parse --parseopt' . ./test-lib.sh +check_invalid_long_option () { + spec="$1" + opt="$2" + test_expect_success "test --parseopt invalid switch $opt help output for $spec" ' + { + cat <<-\EOF && + error: unknown option `'${opt#--}\'' + EOF + sed -e 1d -e \$d <"$TEST_DIRECTORY/t1502/$spec.help" + } >expect && + test_expect_code 129 git rev-parse --parseopt -- $opt \ + 2>output <"$TEST_DIRECTORY/t1502/$spec" && + test_cmp expect output + ' +} + test_expect_success 'setup optionspec' ' sed -e "s/^|//" >optionspec <<\EOF |some-command [options] ... @@ -278,4 +294,32 @@ test_expect_success 'test --parseopt help output: multi-line blurb after empty l test_cmp expect actual ' +test_expect_success 'test --parseopt help output for optionspec-neg' ' + test_expect_code 129 git rev-parse --parseopt -- \ + -h >output <"$TEST_DIRECTORY/t1502/optionspec-neg" && + test_cmp "$TEST_DIRECTORY/t1502/optionspec-neg.help" output +' + +test_expect_success 'test --parseopt valid options for optionspec-neg' ' + cat >expect <<-\EOF && + set -- --foo --no-foo --no-bar --positive-only --no-negative -- + EOF + git rev-parse --parseopt -- <"$TEST_DIRECTORY/t1502/optionspec-neg" >output \ + --foo --no-foo --no-bar --positive-only --no-negative && + test_cmp expect output +' + +test_expect_success 'test --parseopt positivated option for optionspec-neg' ' + cat >expect <<-\EOF && + set -- --no-no-bar --no-no-bar -- + EOF + git rev-parse --parseopt -- <"$TEST_DIRECTORY/t1502/optionspec-neg" >output \ + --no-no-bar --bar && + test_cmp expect output +' + +check_invalid_long_option optionspec-neg --no-positive-only +check_invalid_long_option optionspec-neg --negative +check_invalid_long_option optionspec-neg --no-no-negative + test_done diff --git a/t/t1502/optionspec-neg b/t/t1502/optionspec-neg new file mode 100644 index 0000000000..28992ee303 --- /dev/null +++ b/t/t1502/optionspec-neg @@ -0,0 +1,8 @@ +some-command [options] ... + +some-command does foo and bar! +-- +foo can be negated +no-bar can be positivated +positive-only! cannot be negated +no-negative! cannot be positivated diff --git a/t/t1502/optionspec-neg.help b/t/t1502/optionspec-neg.help new file mode 100644 index 0000000000..591f4dcd9f --- /dev/null +++ b/t/t1502/optionspec-neg.help @@ -0,0 +1,11 @@ +cat <<\EOF +usage: some-command [options] ... + + some-command does foo and bar! + + --foo can be negated + --no-bar can be positivated + --positive-only cannot be negated + --no-negative cannot be positivated + +EOF From patchwork Mon Jul 24 12:40:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ren=C3=A9_Scharfe?= X-Patchwork-Id: 13324569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A28E9C0015E for ; Mon, 24 Jul 2023 12:40:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbjGXMkw (ORCPT ); Mon, 24 Jul 2023 08:40:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbjGXMkt (ORCPT ); Mon, 24 Jul 2023 08:40:49 -0400 Received: from mout.web.de (mout.web.de [212.227.15.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2C9C126 for ; Mon, 24 Jul 2023 05:40:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1690202442; x=1690807242; i=l.s.r@web.de; bh=bBrHcbTLg4eWnsL4LMKy9YRlLsI4qDbTaeCE5A6iY7g=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References:In-Reply-To; b=XdoVL7Pb5i39ZC+a7H26Ti5hpuoy8+g0Mr5Y/lg2OWBLyxK5D08QHgHeGRPUYBL3WHJ6gj0 LjBxRUduYCCbFYPvPJGP795nJBvAVtW4RfJjZiibFJpK4vLwG7YHfL9eKpvH7g6gnqFRg+gr0 MGmV9Pm4kYd6WWlKNa/CUeSJAZLCvw/X0XIk/4xfRbbMhUS0G5z/veEW5I4Ji1ANjgxf8EVkp BRMarVRDU2t8vD4RG6i2wp2BWJ4lEiK+y4MTHRUbA++4Vgud3XBU6TDsIDh1D3naKyCAtVXGA 4weCsKdnzIBVZAHPAvZyHPK0rceb7dQRuf2BsEXIoSMpvtyPaDpA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.29] ([91.47.150.179]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MjBVh-1pjcND0R0f-00f4jJ; Mon, 24 Jul 2023 14:40:42 +0200 Message-ID: Date: Mon, 24 Jul 2023 14:40:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: [PATCH v2 5/5] parse-options: show negatability of options in short help Content-Language: en-US From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: Git List Cc: Junio C Hamano References: <43ca3f01-ba11-6c29-a8e8-4e6c262a68cc@web.de> <4d01e971-07cb-4f11-3cc6-9d9f21e590c1@web.de> In-Reply-To: <4d01e971-07cb-4f11-3cc6-9d9f21e590c1@web.de> X-Provags-ID: V03:K1:cNMJTHSU6cU8UC1VMynwPMMuTE9ggwlHJLthuktHQvU0JhIkxD4 gWbfk2/tcYwe96IaTbkKg4q2eR0XpT/nIe89lt+4WvX+Ugo4qvwq077jhOq5Kv322JCJWtK znlqcIXTtj/vk0pxemm9vbFtK7MSW8SSoCSfoATRv/zNDIFiFBWzRq29hNxreURaodPG55R NJ4s43kfffDNbWkG6hh8A== UI-OutboundReport: notjunk:1;M01:P0:ZEpdciAL66A=;qlxE3WoJkrwQFvtFHAysuWuNceE RLY/V1woptuDITDmv8I+PmVyDBT2rNWnM+35UcTn68lHDvDG/iYL0kBoVvmXd+VjabFnn2NLv OPBDLAWEq8gldTaseRyO9k85scROvK6i3AFPCuGt8AhkOUOeGp5hibpZLmISe2f5ajSGd1oRG eJHPkWUh2Y7TPBh26syQnUjuKU3S81e+VITsf9DO7aU70zXFA67mM3Q0pMWhO+aPHUbOBN9go C5BqECFEPUJAHxUJEFoOIn7Vz1KGFQoetZcLKMBJSQfvhhmBeAVikokbr0vc3IVYtMhtTF+or 186aQE52EO2HDkfPCpXK2Cop9Mc4As2L97qcJTKXcpQKHmoIf0+/OQOAjFTGkCrQPAp2PLIlr ZmUZgvWuOHW9P3mFgBv5iOzHYmEGz2EVtWBUjk7/iAVaXXNLBANCMcp0sZnKNqfk5Kokon0fI u2dfRcUD42bjjNazx40ZuzRwPnxVfa75kQRp3S/YB+WfeQFuk27s5gvC6W3yRlMCNF2B14Y0Y Q3hd6Gzl9C6YMx7JJ3aLGpkNz961nnn0oNQrz+O6FOzVRu/XCZy61hTGVEohE5f0m4LeqGZdi Rr3vcpxj8mLBpN5eOSd/L5jhDuuFe0Ny2QnOuDk5CFl5QJ+NxblWolBN5Icl1akUkMTS9kKH9 uQjiv9pvqHnQMjKPaQ40Klzi/WQXG5xWXIC5Q1OfUJgQUk9qWCLAXzRaiOTrckF1/Ny0IYy0b UKottlGP6tO13sp9ld9dyPlUy69vdCQKcgBLx+b/G54Lo9lnB6JQdySfUQrvPM1E4uynjK4Iq eH2rS3m9/BSpKBbjgS3tkgq1I3hjPxQP3z9+4YlIQQ07GRnKM0bEcJLC9VH3eTKqNV0nTrYA6 VdU6d/llkGXW67ZpJ2MMdFfvnFqkqmtaQJkczSyG51stt6mtzuRG+VzIws2FfuVibx2vntby4 PRpJTA== Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add a "[no-]" prefix to options without the flag PARSE_OPT_NONEG to document the fact that you can negate them. This looks a bit strange for options that already start with "no-", e.g. for the option --no-name of git show-branch: --[no-]no-name suppress naming strings You can actually use --no-no-name as an alias of --name, so the short help is not wrong. If we strip off any of the "no-"s, we lose either the ability to see if the remaining one belongs to the documented variant or to see if it can be negated. Signed-off-by: René Scharfe --- Documentation/git-rev-parse.txt | 8 +++--- contrib/subtree/t/t7900-subtree.sh | 2 +- parse-options.c | 10 +++++-- t/t0040-parse-options.sh | 44 ++++++++++++++++-------------- t/t1502-rev-parse-parseopt.sh | 2 +- t/t1502/optionspec-neg.help | 4 +-- t/t1502/optionspec.help | 35 ++++++++++++++---------- 7 files changed, 60 insertions(+), 45 deletions(-) -- 2.41.0 diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 6e8ff9ace1..6a4968f68a 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -424,10 +424,10 @@ usage: some-command [] ... some-command does foo and bar! -h, --help show the help - --foo some nifty option --foo - --bar ... some cool option --bar with an argument - --baz another cool option --baz with a named argument - --qux[=] qux may take a path argument but has meaning by itself + --[no-]foo some nifty option --foo + --[no-]bar ... some cool option --bar with an argument + --[no-]baz another cool option --baz with a named argument + --[no-]qux[=] qux may take a path argument but has meaning by itself An option group Header -C[...] option C with an optional argument diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh index 341c169eca..49a21dd7c9 100755 --- a/contrib/subtree/t/t7900-subtree.sh +++ b/contrib/subtree/t/t7900-subtree.sh @@ -71,7 +71,7 @@ test_expect_success 'shows short help text for -h' ' test_expect_code 129 git subtree -h >out 2>err && test_must_be_empty err && grep -e "^ *or: git subtree pull" out && - grep -e --annotate out + grep -F -e "--[no-]annotate" out ' # diff --git a/parse-options.c b/parse-options.c index f8a155ee13..6323ca191d 100644 --- a/parse-options.c +++ b/parse-options.c @@ -1136,8 +1136,14 @@ static enum parse_opt_result usage_with_options_internal(struct parse_opt_ctx_t } if (opts->long_name && opts->short_name) pos += fprintf(outfile, ", "); - if (opts->long_name) - pos += fprintf(outfile, "--%s", opts->long_name); + if (opts->long_name) { + const char *long_name = opts->long_name; + if (opts->flags & PARSE_OPT_NONEG) + pos += fprintf(outfile, "--%s", long_name); + else + pos += fprintf(outfile, "--[no-]%s", long_name); + } + if (opts->type == OPTION_NUMBER) pos += utf8_fprintf(outfile, _("-NUM")); diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh index 7d7ecfd571..f39758d2ef 100755 --- a/t/t0040-parse-options.sh +++ b/t/t0040-parse-options.sh @@ -13,29 +13,32 @@ usage: test-tool parse-options A helper function for the parse-options API. - --yes get a boolean - -D, --no-doubt begins with 'no-' + --[no-]yes get a boolean + -D, --[no-]no-doubt begins with 'no-' -B, --no-fear be brave - -b, --boolean increment by one - -4, --or4 bitwise-or boolean with ...0100 - --neg-or4 same as --no-or4 + -b, --[no-]boolean increment by one + -4, --[no-]or4 bitwise-or boolean with ...0100 + --[no-]neg-or4 same as --no-or4 - -i, --integer get a integer + -i, --[no-]integer + get a integer -j get a integer, too -m, --magnitude get a magnitude - --set23 set integer to 23 + --[no-]set23 set integer to 23 --mode1 set integer to 1 (cmdmode option) --mode2 set integer to 2 (cmdmode option) - -L, --length get length of - -F, --file set file to + -L, --[no-]length + get length of + -F, --[no-]file + set file to String options - -s, --string + -s, --[no-]string get a string - --string2 get another string - --st get another string (pervert ordering) + --[no-]string2 get another string + --[no-]st get another string (pervert ordering) -o get another string - --list add str to list + --[no-]list add str to list Magic arguments -NUM set integer to NUM @@ -44,16 +47,17 @@ Magic arguments --no-ambiguous negative ambiguity Standard options - --abbrev[=] use digits to display object names - -v, --verbose be verbose - -n, --dry-run dry run - -q, --quiet be quiet - --expect expected output in the variable dump + --[no-]abbrev[=] use digits to display object names + -v, --[no-]verbose be verbose + -n, --[no-]dry-run dry run + -q, --[no-]quiet be quiet + --[no-]expect + expected output in the variable dump Alias - -A, --alias-source + -A, --[no-]alias-source get a string - -Z, --alias-target + -Z, --[no-]alias-target alias of --alias-source EOF diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh index 0f7c2db4c0..f0737593c3 100755 --- a/t/t1502-rev-parse-parseopt.sh +++ b/t/t1502-rev-parse-parseopt.sh @@ -111,7 +111,7 @@ test_expect_success 'test --parseopt help-all output hidden switches' ' | | some-command does foo and bar! | -| --hidden1 A hidden switch +| --[no-]hidden1 A hidden switch | |EOF END_EXPECT diff --git a/t/t1502/optionspec-neg.help b/t/t1502/optionspec-neg.help index 591f4dcd9f..156e5f0ed9 100644 --- a/t/t1502/optionspec-neg.help +++ b/t/t1502/optionspec-neg.help @@ -3,8 +3,8 @@ usage: some-command [options] ... some-command does foo and bar! - --foo can be negated - --no-bar can be positivated + --[no-]foo can be negated + --[no-]no-bar can be positivated --positive-only cannot be negated --no-negative cannot be positivated diff --git a/t/t1502/optionspec.help b/t/t1502/optionspec.help index 844eac6704..64e8ce9f98 100755 --- a/t/t1502/optionspec.help +++ b/t/t1502/optionspec.help @@ -4,31 +4,36 @@ usage: some-command [options] ... some-command does foo and bar! -h, --help show the help - --foo some nifty option --foo - --bar ... some cool option --bar with an argument - -b, --baz a short and long option + --[no-]foo some nifty option --foo + --[no-]bar ... some cool option --bar with an argument + -b, --[no-]baz a short and long option An option group Header -C[...] option C with an optional argument - -d, --data[=...] short and long option with an optional argument + -d, --[no-]data[=...] + short and long option with an optional argument Argument hints -B short option required argument - --bar2 long option required argument - -e, --fuz + --[no-]bar2 long option required argument + -e, --[no-]fuz short and long option required argument -s[] short option optional argument - --long[=] long option optional argument - -g, --fluf[=] short and long option optional argument - --longest + --[no-]long[=] long option optional argument + -g, --[no-]fluf[=] + short and long option optional argument + --[no-]longest a very long argument hint - --pair with an equals sign in the hint - --aswitch help te=t contains? fl*g characters!` - --bswitch hint has trailing tab character - --cswitch switch has trailing tab character - --short-hint with a one symbol hint + --[no-]pair + with an equals sign in the hint + --[no-]aswitch help te=t contains? fl*g characters!` + --[no-]bswitch + hint has trailing tab character + --[no-]cswitch switch has trailing tab character + --[no-]short-hint + with a one symbol hint Extras - --extra1 line above used to cause a segfault but no longer does + --[no-]extra1 line above used to cause a segfault but no longer does EOF