From patchwork Wed Dec 6 11:51:55 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: 13481695 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=l.s.r@web.de header.b="DQ+jfd2Z" Received: from mout.web.de (mout.web.de [217.72.192.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8A5D2694 for ; Wed, 6 Dec 2023 03:52:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1701863536; x=1702468336; i=l.s.r@web.de; bh=e30VSexU6iTY4JnyBJisySZzkyqUVTSP6NRtOFAYujQ=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=DQ+jfd2ZuUlBlJiCcRBAO0w6OqtZlZz6YNqQlAr3GhXzG656TSdtWvLSiXwhuJt9 euOK3tQq7BAhdTOxu1eUUO9o3uxZKil5MxOAH5pAqBJ9Vs+nSjs38OxMnnm5YuDfu CZ3/shYbnJCEkgIi2OgfzlHFRMuY2op7lCMBs8y4XkHe/bFjyzEBurJt5a05/+9wN FTjXdwhpp19s68ieHHA52gT0N+aDONjSgZjytPDU5tJSEcqX+huXsYsn9aUwoGd5I 9O18IMiIDdbSBJ7vmzvDBf88HLR5wcc9Bq7r3wT3j+s8l5vbcSNnxWaVUKe50oRRZ +JWtU9vxMbBuxUNEjQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from Mini-von-Rene.fritz.box ([79.203.29.38]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1N0qr9-1rPViP1dgL-00wnJs for ; Wed, 06 Dec 2023 12:52:16 +0100 From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: git@vger.kernel.org Subject: [PATCH 1/7] push: use die_for_incompatible_opt4() for --delete/--tags/--all/--mirror Date: Wed, 6 Dec 2023 12:51:55 +0100 Message-ID: <20231206115215.94467-2-l.s.r@web.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206115215.94467-1-l.s.r@web.de> References: <20231206115215.94467-1-l.s.r@web.de> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:fM6cV4jVYi+djW8zTjZNNv31ViK4u50xEpWV0RMMtyd6BD+Tudb HHHwU0Gpd3Z8O6pdpFa7WYYsF0ZDw5mK1UDM/a6t5s5i5K0Kfa4fr0rMoB++ELEYXk4ecZg R+iyvkpfJqMZm2qd6qF62tBN9KVxJtG2jIxo26MmgJ17mNeVcooOrILoWK0LXJoK3NLoYZ2 YUiD9UkqbQQXm0Bl1PRdw== UI-OutboundReport: notjunk:1;M01:P0:ZBePyZbcw/k=;Q3OAU/s2aF+7RwtZX4zjQWJoVhT Gvj9RIHNBNnjKAW0vpz9RyE8sLMm6BeFF7ahJVxA0ema+mmdklR+SG9MBSVEpPG2otyZjBEmx /9j9BVf2Szw6aMSqor2QW/krdMRSD1UXexg/11MogaU6t8os7WAIrgE8iRZYigVlm+Fm8v0fe +6iXpXoCJYydPfJ6cj5rRnxCEhriRrLcL90xXJbQwRTfDUQEKrrS+rwyFv8hD2PeuxKzXmce8 ShAnmJWSjJdsfitH1hqbhsqOm6U0TN4KQbYT+wDdwthF6Ew/YKud7wXdXN6fTdxeEh4lbphQg 5WQwe3msIoY687QN3My8uh4oqV60klkhgr9L32OFNYi7rqO+kcqvxjAS840iA7m6ocS1ThP4O oqFvRquvm/d03PR+msKuYwkp9SizThQTRqn4OIENUKW1K4XS+snAUwLmEc+Pn5ZPrRoaDbeMp lFZQVBCaSTZzzZptX7WBkyewAgHjUf/q/8QCUKTugcb7UhqASidyrO9SkAhjjepv64N4TcfVj mPYZh2Tiq4LVbV5LN4E96UBdM4gcK332Jnt0rd32S31tJs/zHzBQVe6XVgk/fE0lh4KtfcTax tJAVZt4Egxae1LGpmMN78O4Yiq8Lz4WeR4WEtWR7MTGCwkMjqQfZ1eJWm63AjtJZ3C4JsZdhp S1BgCO5r+a2qR9tikFwRmz8HCFCKorv8qKm6jcC8feDKXyfKHSflzGyBUj0N+8R3CBftLHQ2a 7VU2gfja1Pt0zYDq41QMWk2bSCc6KhQnn7Tc/dGnN+bXxvh50cbK/9MTuhj3JCjx1eG4MprPL yg9ilcrA+BdWXIJY2R41CE3JwyZR4l7PwCuFZjgwxMcF1HAPfbPcmUeq84jusQt+cJIxwHscB 2FEKnxnpqu/hG3wRb2QzemaAlB6giydnaJ0ETfmSpqsrdqz4VUnMRwENZRukPmFwNurUWSMMq 1LuIOxuZzvm75jCJbT9mWzvwtnw= The push option --delete is incompatible with --all, --mirror, and --tags; --tags is incompatible with --all and --mirror; --all is incompatible with --mirror. This means they are all incompatible with each other. And --branches is an alias for --all. Use the function for checking four mutually incompatible options, die_for_incompatible_opt4(), to perform this check in one place and without repetition. This is shorter and clearer. Signed-off-by: René Scharfe --- builtin/push.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) -- 2.43.0 diff --git a/builtin/push.c b/builtin/push.c index 2e708383c2..f77f424324 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -639,8 +639,10 @@ int cmd_push(int argc, const char **argv, const char *prefix) : &push_options_config); set_push_cert_flags(&flags, push_cert); - if (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR)))) - die(_("options '%s' and '%s' cannot be used together"), "--delete", "--all/--branches/--mirror/--tags"); + die_for_incompatible_opt4(deleterefs, "--delete", + tags, "--tags", + flags & TRANSPORT_PUSH_ALL, "--all/--branches", + flags & TRANSPORT_PUSH_MIRROR, "--mirror"); if (deleterefs && argc < 2) die(_("--delete doesn't make sense without any refs")); @@ -677,19 +679,13 @@ int cmd_push(int argc, const char **argv, const char *prefix) flags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE); if (flags & TRANSPORT_PUSH_ALL) { - if (tags) - die(_("options '%s' and '%s' cannot be used together"), "--all", "--tags"); if (argc >= 2) die(_("--all can't be combined with refspecs")); } if (flags & TRANSPORT_PUSH_MIRROR) { - if (tags) - die(_("options '%s' and '%s' cannot be used together"), "--mirror", "--tags"); if (argc >= 2) die(_("--mirror can't be combined with refspecs")); } - if ((flags & TRANSPORT_PUSH_ALL) && (flags & TRANSPORT_PUSH_MIRROR)) - die(_("options '%s' and '%s' cannot be used together"), "--all", "--mirror"); if (!is_empty_cas(&cas) && (flags & TRANSPORT_PUSH_FORCE_IF_INCLUDES)) cas.use_force_if_includes = 1; From patchwork Wed Dec 6 11:51:56 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: 13481697 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=l.s.r@web.de header.b="Oy6Qxg0+" Received: from mout.web.de (mout.web.de [212.227.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEB782695 for ; Wed, 6 Dec 2023 03:52:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1701863536; x=1702468336; i=l.s.r@web.de; bh=MgY8AnrtULKrhNi/5xQfrcBwgq4tGWjiO4zFtcsRquI=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=Oy6Qxg0+IeA8+NWLjW8i2M21eyQiRApV1SF27UQwloR3wU+snwrg68RtQkR3nC7m PHIVsvl5fpbr5XwJ0vZqlUVJ+jCtWiEa8uiqnRMLaNjXpEsZ0n64N7iFIRGKo2Pxc e/7JZjETk8CPeai7H0vlNiSUSIVWFzkI2NuOGgCngULRGGqemQOKlvO3mMlWhNkl8 2SZ2DWL9vsZs5KKDQgFf7cgJXWPwXq3giphOVakErgcF4m42aF2wu4bQbRYJ0f7ln gGuv8DSzOAboHgDTyPVFIng0Hqg7nOZ2kK7YN/4CBTQr7G4Bsx7EPMr8Lnq9OqQ8Z 5ehJRtAPaWCE8JJbXA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from Mini-von-Rene.fritz.box ([79.203.29.38]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1Ml4B4-1reex22I60-00lTiP for ; Wed, 06 Dec 2023 12:52:16 +0100 From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: git@vger.kernel.org Subject: [PATCH 2/7] repack: use die_for_incompatible_opt3() for -A/-k/--cruft Date: Wed, 6 Dec 2023 12:51:56 +0100 Message-ID: <20231206115215.94467-3-l.s.r@web.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206115215.94467-1-l.s.r@web.de> References: <20231206115215.94467-1-l.s.r@web.de> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:H6FEy+PKOlySeQPAbkO01xQ1OZzLUijXUY2dVl9krw9fa7rrrPV 54XkG/RSY0gSd07kDdKnRsRc38+chBiqK4I3Tdj90SmdSinQDf7BpnrBWXqmvVoo8r+j5XW GIDabja3GLTi9CVkrSxxT+5KziJo5E8OdFBQpGpGeOoopM9O0K2USD+7UkxyZNfO09Qe14s yBNkfdrS6O6XWRsqo72gw== UI-OutboundReport: notjunk:1;M01:P0:OE0HOpX42rc=;E1+UuiKpkXqoKki98yp7w0KnjGT enOERYAO5gH0SdwDQydIvoMNJT0J8JUezRtr4YFmv2ofopqLUXpnYNNWR1Idnwyioeqz3uQnp cH/c5cgijgYoap/0YOWestyuouDnMr+8JzOz6fDFTOexaJ5qrzZPGxTja5/KEcyAP3dEq0zJp /FtnTdV5OWdefrWm+hpZ+9Jz6XfXMG0tYY3Xj5AHMei4Vfz8N1JqEE8Z6HHweutux3yhtckna XtrxBKNwI9nKm+xTUVuNlCPGwHchxmoldDB0t5m756oUFxn7u4sBeDavDIHc57htWjIzwj5++ pxO8JaajzYi7/pTaE7OC0dvJmqO+BUqfslRjB1ShmSYqe/izesxW1DSsS1ejzvGwp2i4OH599 4XMR1UW24av15a2IrXzr31DUhSlnFt0eZwW7YmNg/o47rqds7qcFMg9RRcWyUk3Xb3/p7TCHx o5SJiGJHsRm64YHl+3v52+dR+i49T6XmPv45nwPlIumcbljb/FD27wFX/2MLRyJo7DYQDD8T9 +An0EmECNo9IIw4zuY8S3BcnOZBRBMKkxMdFts98fttccPD0sTCNPuJ1jv/Sc9VR0ufSm9EHp 8Pj07a7w2gE5+P8ChtfjQWRwg1kzPRodxomtzedlXTtPFIX56fjvnoQqHhOKrOn9bK+Q0x7Tc A36NebTo5tvsZNG83ntMwbYGty8Amk4CNhtWusSRzPVNmbR+tnUHyvbtsFGD6MbPbNQjvM9Gp 6SmShJUykC8j6fA/mgUWs0yKCBVvH6hN7DWfiSPEv6jHxt3NYB2mVnGZhm2kJwtVlf/d9rRMn VbZTtg9XBZnrNl4WAicC+0kyD9gujd0/kXCwy7FKoWXGpeh9TgLpECGKPbixVkqomcZTU8PyO 8HtnZD6IqlL6i4GfavbHBjkVqCuGKTy9wxFIYmnkEY5jymGwMclkihLZHbXyleO9dSnvrpSFX yVbQcQ== The repack option --keep-unreachable is incompatible with -A, --cruft is incompatible with -A and -k, and -k is short for --keep-unreachable. So they are all incompatible with each other. Use the function for checking three mutually incompatible options, die_for_incompatible_opt3(), to perform this check in one place and without repetition. This is shorter and clearer. Signed-off-by: René Scharfe --- builtin/repack.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) -- 2.43.0 diff --git a/builtin/repack.c b/builtin/repack.c index edaee4dbec..c54777bbe5 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -1203,19 +1203,13 @@ int cmd_repack(int argc, const char **argv, const char *prefix) if (delete_redundant && repository_format_precious_objects) die(_("cannot delete packs in a precious-objects repo")); - if (keep_unreachable && - (unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE))) - die(_("options '%s' and '%s' cannot be used together"), "--keep-unreachable", "-A"); + die_for_incompatible_opt3(unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE), "-A", + keep_unreachable, "-k/--keep-unreachable", + pack_everything & PACK_CRUFT, "--cruft"); - if (pack_everything & PACK_CRUFT) { + if (pack_everything & PACK_CRUFT) pack_everything |= ALL_INTO_ONE; - if (unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE)) - die(_("options '%s' and '%s' cannot be used together"), "--cruft", "-A"); - if (keep_unreachable) - die(_("options '%s' and '%s' cannot be used together"), "--cruft", "-k"); - } - if (write_bitmaps < 0) { if (!write_midx && (!(pack_everything & ALL_INTO_ONE) || !is_bare_repository())) From patchwork Wed Dec 6 11:51:57 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: 13481691 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=l.s.r@web.de header.b="XM28uQqJ" Received: from mout.web.de (mout.web.de [217.72.192.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6EE02693 for ; Wed, 6 Dec 2023 03:52:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1701863536; x=1702468336; i=l.s.r@web.de; bh=HVOrGBTAAv8zt2YGOOrWM95SylDKWq1BwkEdTa3klPE=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=XM28uQqJ8+TyxbfppqlREVofg9jyyGZo8Zg+AKGz46tdkn3VaUjVK8EWMTSClSQq KFI2z5/pCmlz7PnMRU/kSygviYYo1NblBbsWnJRBofp2RnvFv8s2dKIfwnHf89oAR n2Q2lG/+Ev601QnqnZiWXYDon0LYRxnAgsh7/3VcPiRBbuVJHDR3Vt5vaWohItjqU AHQ8y6WQR8URrp8HxM78lE5l5g8oHKPbdGjmLCiCHGFY32ikJnQKs4wmvdZN1asKq 08IN64x6AQZZVk50sTvZywCb2+M+iQvkAZ0X4tq6ytdI1tO/ED4aRoAy2QwCsF9hj ArpsbQtW7BAlv+MpoA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from Mini-von-Rene.fritz.box ([79.203.29.38]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MSqXM-1qoCxK2xlm-00UMXP for ; Wed, 06 Dec 2023 12:52:16 +0100 From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: git@vger.kernel.org Subject: [PATCH 3/7] revision: use die_for_incompatible_opt3() for --graph/--reverse/--walk-reflogs Date: Wed, 6 Dec 2023 12:51:57 +0100 Message-ID: <20231206115215.94467-4-l.s.r@web.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206115215.94467-1-l.s.r@web.de> References: <20231206115215.94467-1-l.s.r@web.de> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:WvkXJGfs5yqDmIqY47lq1GJiYFAf6y55axTU/N+AHSdJaoT4XBn 23dC9gkq0qW5y7LvYP2TIqnf4hV4EAUyO4n1u55lkUQwt0oDkHW4VyoTDusQA6QumPi6Bfn CZlrhz1dJ1CYp6dFZYOEDKrEwB7J3Za2+fl4XhdGsNS9FeAzJgSPTkMEltPB/WLOf5qnSbU iJCCzsJUs3U6fISy+N+Sg== UI-OutboundReport: notjunk:1;M01:P0:BHXpB25+Pu4=;Ot72ymAP9ojVy6EkIFl2AC4lr3K hel2ENkflSSAsWg5hB23TnnXHDOIRkGPuWG6ba6cKTo/70/Q4ryY6y6t5Mqp65Gj4sxQ0M6s4 fSKbCjgS3xsP3Sdtl0KXMWu8CWndY13Mw27Te4QlPxNv6Mjt0rUS8Yaik2nf38Ys8WayE5C8B wApgPUSItqEiJDgbCBB8HsGSBrdAOWRb3gofr8siH7VG+E5HtpP5TGD8kPJKSWcmYlPLJN5P7 nEsY7oLvAJAzUUKrKt1D4P5f6xX3J9RjR74B7MAAbpORxBWZ2AyJuZjLCay8YqNFDuQKE8J7z OTlbJjCK+oXXB3q+q2SQJ+7uXtf+MNDgAGBgsXnk2f4eUHgGVYfgBN+XHNG6Hi9w+WKLlK8te 0e1iW3yLOMR5OFyeJTbFkocrH/hEGWis9ZZ1IQ0WmefKPmEVe391Wmbyj0z0ZmdKZDZi9qk3W qSKGs4L4Pn3RNar53kDbnfWT/BuCoOX3+x+wPpTMzsiDaZOCGNq9XsE4SCizH0b/287A5K5hj q6sDTdUiIMcqbqw9tGCnqd6QgfogsuArNIL/YhMpZnOvHIQRvuJTIrQZVxp+5AVCMdTQJI6IU B5BtDTWHyW7TrhtK/VI7278eU24xfdv90meaZ9IRfOmEsaNTKzcnv0bxlM1OvbFoHUK9HMtJU dhwkDPiS2xy8VFHRHs3vPNt6h5YbMA14lp/6uvMJkBouY9Bc89jb1kNJmh/w5jGmsEDnc3GIh qsTkBbL+YIldrcZLqy9O+ZwYwKihhsKXHPh0na9VRtHbz9iVdM2poAnI3nszf2GWvEQBZ0DdK My6t3Qw80GXCORBFmDX9913G81Q5TvrS6FYg6Ujy3TVRIKcKydCAA22AsqI8CT23Pw8SLmn/L 76onbD0+p2uO3c39RAfPCFm8PZntAiiJrg7y6sVUMskl5geLDWpYriOUiJzSqw5L3Wh0I62cx terjfA== The revision options --reverse is incompatibel with --walk-reflogs and --graph is incompatible with both --reverse and --walk-reflogs. So they are all incompatible with each other. Use the function for checking three mutually incompatible options, die_for_incompatible_opt3(), to perform this check in one place and without repetition. This is shorter and clearer. Signed-off-by: René Scharfe --- revision.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) -- 2.43.0 diff --git a/revision.c b/revision.c index b2861474b1..1b7e1af6c6 100644 --- a/revision.c +++ b/revision.c @@ -3036,8 +3036,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s revs->grep_filter.ignore_locale = 1; compile_grep_patterns(&revs->grep_filter); - if (revs->reverse && revs->reflog_info) - die(_("options '%s' and '%s' cannot be used together"), "--reverse", "--walk-reflogs"); if (revs->reflog_info && revs->limited) die("cannot combine --walk-reflogs with history-limiting options"); if (revs->rewrite_parents && revs->children.name) @@ -3048,11 +3046,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s /* * Limitations on the graph functionality */ - if (revs->reverse && revs->graph) - die(_("options '%s' and '%s' cannot be used together"), "--reverse", "--graph"); + die_for_incompatible_opt3(!!revs->graph, "--graph", + !!revs->reverse, "--reverse", + !!revs->reflog_info, "--walk-reflogs"); - if (revs->reflog_info && revs->graph) - die(_("options '%s' and '%s' cannot be used together"), "--walk-reflogs", "--graph"); if (revs->no_walk && revs->graph) die(_("options '%s' and '%s' cannot be used together"), "--no-walk", "--graph"); if (!revs->reflog_info && revs->grep_filter.use_reflog_filter) From patchwork Wed Dec 6 11:51:58 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: 13481692 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=l.s.r@web.de header.b="lRloUT+J" Received: from mout.web.de (mout.web.de [212.227.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9044B269D for ; Wed, 6 Dec 2023 03:52:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1701863537; x=1702468337; i=l.s.r@web.de; bh=Z2KAtMlAnKkxVgsQqWkaLDl1RL1w9S/rGzm5Bg1XFtU=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=lRloUT+JDxuRnYm2zXtaZ7vy7tCO3NnmDV3KBkuWQylpd1mtVm5n/6WjrW9zpQdf KIebqymMXQ2N4DqNladCUN6BAyTpZ/51yVzgdcXF6s1z0saq0sn48pG6JRomAk8b+ klipAI/dZTUncIdACCgD+GQG3t41LLj4TyNi1gU8JeeNbUXPs3dmxFPam/ovVilJo 7rm7FtMozI2LQM2+eAxFPB5HmRq09gRqicnXpXvXPmSTNd2ugpooAqjGKsoXxfAxZ 2UYQIrK1bKstambM3rJqLPZNc5vKaPHYEdv8XnabNm99++MeS5/jOFIJ9/bKp4HEQ g9DY3YWtaxvhahssow== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from Mini-von-Rene.fritz.box ([79.203.29.38]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MSIJ0-1qmYGG3cj2-00SiNN for ; Wed, 06 Dec 2023 12:52:16 +0100 From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: git@vger.kernel.org Subject: [PATCH 4/7] revision, rev-parse: factorize incompatibility messages about --exclude-hidden Date: Wed, 6 Dec 2023 12:51:58 +0100 Message-ID: <20231206115215.94467-5-l.s.r@web.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206115215.94467-1-l.s.r@web.de> References: <20231206115215.94467-1-l.s.r@web.de> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:7BfOCIPG5pl+P1dWucy9ly4/QujrT+glZqxwId/R7BWjtz8XVO7 bPOmQGLq1T9mBmGk1ZRxsoTkXRZ1LhKVVP2K6b8Gor9jiFel7Mu92xAvkMEarDB1aJZvsDT MElrm9vMjLQRO6fTe6a1HU7MzDDaZpyXxnhOePN2lKFLfVZIjqM9SXf8DXQzqMnIIGcf5rD HmMhTbo9LbG9oxP4pqXlg== UI-OutboundReport: notjunk:1;M01:P0:cG6HfNJF7lU=;vLQWYQptPtXCJkH9dZTg1PMQjTG FJf4uv3hwm5aWr00oA/iwQwbXKbOSxg8penLBd6dtQvzyuL70ABFyQokxuyAtJMKRlzFoWGsq YxaeEtEGgnT2nN7s2VZZwe5Q2vRpYYt3NgltGwJcTOAjIQS+wlBwtblEE2tQx6AUUJL48SSoW ea+5PT064eK7UzkA8rajv5UkAtxgdo5hl3zizwDV8hX3RogIjEgZyZKKCsJySViINO970nUTP /6qDVJ4Kn4f5OVsxgPYAmZidk1N1pW29/+TBowSFg1DKnFIbW6wCzF25XtSo5BYyNYVUXcsne Tw1zmLTjnf64ra6UXVQ3VY9Ld+ImsQpbXmSUJDp5/GVrbC/ZHTeILRWJVMywByXQ2dhXs02Bq wOShB4ucnOA7ItdyA/uAxJ56WVV69q1dwcKyd6ftyGfBzbk2fmO7zbeFZwvjn5Kysv/HA+48m PxQPmUTtVJWgUTbSGQaDtVteCreyc6H510f6j8zI4ZZwuByzIxEww/C8UgxPWb8svekv64F3Z gpGhmVQURokeCB7UedwDYGKF1p9dosZpzYG9Femt7EI/k9DEZ3bY8X9tOaykXEzil5HYCcNrT Fcr4nskDrlWNnOBYx8DMSr5p9psAOVJJUDCBeq44tPSyVxcr6s/vCVvPFmkwQnj9xeasQG/Yt 4dvXmMIuCNPfcBeP/R1pT2EUSG43HHvshTt9ezQtuhgw26R/QC3ZrkUrBsf3K0stxCViO2Vfg hh3JVZkoCUtWF03VOGphcF+kQpTkVFHiyP/C/vTZ1A1c4nFvk0g7bZB5KmdJDZdLZYFYxYyN0 nijlzWwfT2O04qoeRqcM7hG9Qxl2r0mG+p12/kVZ8L2KNwv752FP7nBPfUzSO0fcDS0MY5PHP e0Bp/Fib9yFKE2oYbcZfbUIVo70eQKgIWV2nkVXQugUXpYyvg2Lo/7BdD6uRoMoXv/2Ok1o/h 7wT7TA== Use the standard parameterized message for reporting incompatible options to report options that are not accepted in combination with --exclude-hidden. This reduces the number of strings to translate and makes the UI a bit more consistent. Signed-off-by: René Scharfe --- builtin/rev-parse.c | 9 ++++++--- revision.c | 18 ++++++++++++------ t/t6018-rev-list-glob.sh | 6 ++---- t/t6021-rev-list-exclude-hidden.sh | 4 ++-- 4 files changed, 22 insertions(+), 15 deletions(-) -- 2.43.0 diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index fde8861ca4..917f122440 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -893,13 +893,15 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) } if (opt_with_value(arg, "--branches", &arg)) { if (ref_excludes.hidden_refs_configured) - return error(_("--exclude-hidden cannot be used together with --branches")); + return error(_("options '%s' and '%s' cannot be used together"), + "--exclude-hidden", "--branches"); handle_ref_opt(arg, "refs/heads/"); continue; } if (opt_with_value(arg, "--tags", &arg)) { if (ref_excludes.hidden_refs_configured) - return error(_("--exclude-hidden cannot be used together with --tags")); + return error(_("options '%s' and '%s' cannot be used together"), + "--exclude-hidden", "--tags"); handle_ref_opt(arg, "refs/tags/"); continue; } @@ -909,7 +911,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) } if (opt_with_value(arg, "--remotes", &arg)) { if (ref_excludes.hidden_refs_configured) - return error(_("--exclude-hidden cannot be used together with --remotes")); + return error(_("options '%s' and '%s' cannot be used together"), + "--exclude-hidden", "--remotes"); handle_ref_opt(arg, "refs/remotes/"); continue; } diff --git a/revision.c b/revision.c index 1b7e1af6c6..25335a74ad 100644 --- a/revision.c +++ b/revision.c @@ -2709,7 +2709,8 @@ static int handle_revision_pseudo_opt(struct rev_info *revs, clear_ref_exclusions(&revs->ref_excludes); } else if (!strcmp(arg, "--branches")) { if (revs->ref_excludes.hidden_refs_configured) - return error(_("--exclude-hidden cannot be used together with --branches")); + return error(_("options '%s' and '%s' cannot be used together"), + "--exclude-hidden", "--branches"); handle_refs(refs, revs, *flags, refs_for_each_branch_ref); clear_ref_exclusions(&revs->ref_excludes); } else if (!strcmp(arg, "--bisect")) { @@ -2720,12 +2721,14 @@ static int handle_revision_pseudo_opt(struct rev_info *revs, revs->bisect = 1; } else if (!strcmp(arg, "--tags")) { if (revs->ref_excludes.hidden_refs_configured) - return error(_("--exclude-hidden cannot be used together with --tags")); + return error(_("options '%s' and '%s' cannot be used together"), + "--exclude-hidden", "--tags"); handle_refs(refs, revs, *flags, refs_for_each_tag_ref); clear_ref_exclusions(&revs->ref_excludes); } else if (!strcmp(arg, "--remotes")) { if (revs->ref_excludes.hidden_refs_configured) - return error(_("--exclude-hidden cannot be used together with --remotes")); + return error(_("options '%s' and '%s' cannot be used together"), + "--exclude-hidden", "--remotes"); handle_refs(refs, revs, *flags, refs_for_each_remote_ref); clear_ref_exclusions(&revs->ref_excludes); } else if ((argcount = parse_long_opt("glob", argv, &optarg))) { @@ -2743,21 +2746,24 @@ static int handle_revision_pseudo_opt(struct rev_info *revs, } else if (skip_prefix(arg, "--branches=", &optarg)) { struct all_refs_cb cb; if (revs->ref_excludes.hidden_refs_configured) - return error(_("--exclude-hidden cannot be used together with --branches")); + return error(_("options '%s' and '%s' cannot be used together"), + "--exclude-hidden", "--branches"); init_all_refs_cb(&cb, revs, *flags); for_each_glob_ref_in(handle_one_ref, optarg, "refs/heads/", &cb); clear_ref_exclusions(&revs->ref_excludes); } else if (skip_prefix(arg, "--tags=", &optarg)) { struct all_refs_cb cb; if (revs->ref_excludes.hidden_refs_configured) - return error(_("--exclude-hidden cannot be used together with --tags")); + return error(_("options '%s' and '%s' cannot be used together"), + "--exclude-hidden", "--tags"); init_all_refs_cb(&cb, revs, *flags); for_each_glob_ref_in(handle_one_ref, optarg, "refs/tags/", &cb); clear_ref_exclusions(&revs->ref_excludes); } else if (skip_prefix(arg, "--remotes=", &optarg)) { struct all_refs_cb cb; if (revs->ref_excludes.hidden_refs_configured) - return error(_("--exclude-hidden cannot be used together with --remotes")); + return error(_("options '%s' and '%s' cannot be used together"), + "--exclude-hidden", "--remotes"); init_all_refs_cb(&cb, revs, *flags); for_each_glob_ref_in(handle_one_ref, optarg, "refs/remotes/", &cb); clear_ref_exclusions(&revs->ref_excludes); diff --git a/t/t6018-rev-list-glob.sh b/t/t6018-rev-list-glob.sh index 67d523d405..3b181f771c 100755 --- a/t/t6018-rev-list-glob.sh +++ b/t/t6018-rev-list-glob.sh @@ -214,15 +214,13 @@ do for pseudoopt in branches tags remotes do test_expect_success "rev-parse --exclude-hidden=$section fails with --$pseudoopt" ' - echo "error: --exclude-hidden cannot be used together with --$pseudoopt" >expected && test_must_fail git rev-parse --exclude-hidden=$section --$pseudoopt 2>err && - test_cmp expected err + test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err ' test_expect_success "rev-parse --exclude-hidden=$section fails with --$pseudoopt=pattern" ' - echo "error: --exclude-hidden cannot be used together with --$pseudoopt" >expected && test_must_fail git rev-parse --exclude-hidden=$section --$pseudoopt=pattern 2>err && - test_cmp expected err + test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err ' done done diff --git a/t/t6021-rev-list-exclude-hidden.sh b/t/t6021-rev-list-exclude-hidden.sh index cdf7aa9427..51df02105d 100755 --- a/t/t6021-rev-list-exclude-hidden.sh +++ b/t/t6021-rev-list-exclude-hidden.sh @@ -151,12 +151,12 @@ do do test_expect_success "$section: fails with --$pseudoopt" ' test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt 2>err && - test_grep "error: --exclude-hidden cannot be used together with --$pseudoopt" err + test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err ' test_expect_success "$section: fails with --$pseudoopt=pattern" ' test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt=pattern 2>err && - test_grep "error: --exclude-hidden cannot be used together with --$pseudoopt" err + test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err ' done done From patchwork Wed Dec 6 11:51:59 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: 13481698 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=l.s.r@web.de header.b="KeEdlKW6" Received: from mout.web.de (mout.web.de [212.227.17.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EB552699 for ; Wed, 6 Dec 2023 03:52:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1701863537; x=1702468337; i=l.s.r@web.de; bh=NxOpT11+q7hNGVCSOPVILaxBvK7225Koc9zvX+NQf8I=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=KeEdlKW6kVjnitxeFyrbmkJrwxgoFEtn7rfv2j+nwf4xQI8GMDZUackXAsE1gjZ4 5+/1oGqHNyff25BmbSyEVfRKleN4mkxtkDctRayipZIvf/O0Y+FjtvnRFVtGhtm8e oJ/a/WXJAGUnbij/JTJbWwM39svm651FMyzu4aI6jDuPGYvoJEBolV5IQtIDksviw AeUuT+8rlqo0wqyZTXkCvRScmzvQ3OQcELBrSvsFmkYtwrSbhVpcXYU+hUQyv74jR v+aawpe2bhMhMVaaeE6Puf3YWtQEXukT/9oKGSnnRaNRvmxSKkhrG+zaPWMcyCBUv 2kODZbR9BVoycmLdPA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from Mini-von-Rene.fritz.box ([79.203.29.38]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MbCHy-1rmOC105d2-00bY53 for ; Wed, 06 Dec 2023 12:52:17 +0100 From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: git@vger.kernel.org Subject: [PATCH 5/7] clean: factorize incompatibility message Date: Wed, 6 Dec 2023 12:51:59 +0100 Message-ID: <20231206115215.94467-6-l.s.r@web.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206115215.94467-1-l.s.r@web.de> References: <20231206115215.94467-1-l.s.r@web.de> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:hessLX5cjneo1Rc4JYK2ayLuyvJN+Q1BHmgeNzJRU/hq/eZmY4K lXqCUSnWf/tJ5QNZk4qdLb3fJqpJMm1iKArx7DcHLbD+LRHhEB50tjljvRfQTuHmbJjKESP qjHyz1/nCDnKJmFEdwY/pYkYYE3jjcqXABKmy7mTWuoJ40T/931V2FXaqH9atWA+FeMBDTa DH0aKS1oiJXs5ltBCPYdQ== UI-OutboundReport: notjunk:1;M01:P0:7VencJWmXy4=;7YxQv4GnNFh/VxOU/D871AQB59y IVMEoTX71iGxOZxVZL7t++SAzCEwRp8LxxXSwhu39OIscJKhrPqHfM6PXc1ZRuHGmk1ZtLPhv Wn0thc/NzPUf2ru0KIoXTb5ptekhl3JB9KPHBn3wXdlvdVxc25bYikQ+2ydW34EYa5r/Dblpn 8Sz/xnORPq4RRj/W3IAdym/rTfoL6Vy8gbKsGQBTwCGKHmHNId1E5oaoztx9OVOGlr4fNwu/m qBCOmc/1bOK1+4e7jn9FvpZGMLtlKyx6asmmbb/NNHVExEyNBxSCJWDKA9+bd7b7FidcSS3d1 h5WoFQ7vFNzwkbOdDJ94lxmZKwF/+GO3qqAvQOoRndjlqZqEBAJUXfgXSQXR6RBDAXDSX8FZx nm8rOSkyLv33Tiwj+EVStyvtx+3lnfsXPcFn/Negx5RUWgj3GCMY2RxK9j4APEjUCCFsp0c8e Ovk2BPDta4sYfq3fTbt3hP7DUbYz1cBNybX8EL/q3Do547UR5YzcxRI9aQaOFISemU9mfFBN2 9DYEKEYrYQinsA4/In/3qwuUhWi3RSqEfL/aGCO/qS1rpoF9wmh0zLdCzy5b6yfynvoc6+8r+ 8NC0GUsBG61BOgx/+CNHOiL3Szeq/tbplu76ah7OFmnbdxAVtVpBbO3COkQXZdsUJlnRMzcp1 +nHvH0sPW80wQH4EjZlDn5E/7nkNUCsI1LAxT17hA7+C5Gel32Dk3a8jvyzoesI1iwYNRZooG NSl6s2LXAN0kiEEugQsQywOyC+UisFLZ5mwkiJPi0rgMQmlu4ZyXjKynDfv5xfoP6AWkM/Fw9 TGiZdIS2fxn93tpvNodZZcx+rwGX+au0Fk2jPnojsKsIDNV5iC3J2JIICmJNP7kTzqD/tsEJj WDOcrm+OAIRCg+pPVRC2uaRUF5xP5HUNLp7N6DoCRg5ImOnXlmfkywXx0qgrsZOcS3Oip6T8x xJr+ig== Use the standard parameterized message for reporting incompatible options to inform users that they can't use -x and -X together. This reduces the number of strings to translate and makes the UI slightly more consistent. Signed-off-by: René Scharfe --- builtin/clean.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.43.0 diff --git a/builtin/clean.c b/builtin/clean.c index 49c224e626..d90766cad3 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -971,7 +971,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix) dir.flags |= DIR_SHOW_OTHER_DIRECTORIES; if (ignored && ignored_only) - die(_("-x and -X cannot be used together")); + die(_("options '%s' and '%s' cannot be used together"), "-x", "-X"); if (!ignored) setup_standard_excludes(&dir); if (ignored_only) From patchwork Wed Dec 6 11:52:00 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: 13481694 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=l.s.r@web.de header.b="B4CUyaYr" Received: from mout.web.de (mout.web.de [217.72.192.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90AC5269F for ; Wed, 6 Dec 2023 03:52:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1701863537; x=1702468337; i=l.s.r@web.de; bh=6bTPJiNA+Mi1lrwk0KTi0BGp1K1afYsH2/D0QAhzAXY=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=B4CUyaYr9b/H5A0QJuaHjlOBvN8JHVZfzwg2nzc2++jK8MsNwDC5XZqza3bAc8x/ QkDMCR18BAYlGhXh7v8be+QeSL36zlS7cw4NFRbuIaTDfxYFx6ZvpqKh907t3zpWm 1KGRNAoDMceiftOW4Wuzkb73dudr+vPvpmeq4SvMxFm3GVptsYujk4Ye9orScx+wr 6pbeqvMUgk0nnzHDuGisiC2AcsdDVHvGhWqrKe5xbNeehrlkKuIe7gLSVPW6PVC1d nybrqHcUL4S9tX9R/JssfftDuE6Pe1BLEMHS1J7XUQi58DTIVkb2VOiKvfRxLSjRJ RC5M9gIWLlcQJdt9OA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from Mini-von-Rene.fritz.box ([79.203.29.38]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MhWkj-1rgctO0Tfn-00eaDC for ; Wed, 06 Dec 2023 12:52:17 +0100 From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: git@vger.kernel.org Subject: [PATCH 6/7] worktree: standardize incompatibility messages Date: Wed, 6 Dec 2023 12:52:00 +0100 Message-ID: <20231206115215.94467-7-l.s.r@web.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206115215.94467-1-l.s.r@web.de> References: <20231206115215.94467-1-l.s.r@web.de> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:I8SB8o8bwuwcdSxsp3m++j9CZILjSILBmD4NBPaKa8NNAupDJMQ gXIbiOkXz4pRRgSONGLQrsfxggDxBDQXAhdTLgi7QCWKMM61WeKZkTKNGEymCyWI7lA8bAm bdk8lc2m8Fw45pwHO883UynbBBiyKruye43A8xi+sC8A2tz7JdY71071Odjh23lTMRuNrhX ovsxjXlWKRY5BxkGsEzAw== UI-OutboundReport: notjunk:1;M01:P0:4K4FP00/rkc=;50MBU669GK0oog3ZvxFLn1DSopp VS+rHZNXRP3Q0NBWPPYc1E6t9IQIG/jR/v9KINHqcGssJ6VuSoXUQSGP2FGNbMBbGhKrXHt7Q zSSim6L5MaLY26gJnms8McDsHiALD9U9dcSPuda/Sz4lK965nj0BZNhE5/BH+1LfB5DuPKmPl nvs1njIQUaNrO/1lzKFgpq8NhD/zJbKV9E5dud0Vvjhlh3/BybqAixloj9nX7YP7UAJC0qhLJ fxJr2kdyirxHpxHH4c3KDN0IpomwI1LmRnir9Q30+62++x5oye8MK3Jp/RaNeXL0FWOMsrtWV wzUxZ9caOblKPngtK1LQv5Ys7XOQyFI4KMjNUzsZSHxweXOYpUfOKBsxMNAbXIqnipo31EtmX GpfBtd4rFE03MhSKXQ3WSZB/wUDCfO/8bjADm1aogAQ1knqyiQ5jDDySTIVt3TtEQ6s/DGpqt CtsNyjtLhA9Ns12L+0i+BM+34IwyGlnOvdvd5Gzvj+wOXOWHZowSGINDIqBYIJrivrsY/HCSk a+mhJRrhKGlteB5hTJy8fEyWyotn3IqbSVNc4MWs7e1pp9FE+7eYoi02M6lvRe61cZSEjogTd x1jHqCMxgVPMw8WA7yHxTOprTGv0rXPqiw5gSGyBXQw2eNy2CmDX0lfs2F1lmobxM30NNQiRE teQuuuOZ3TLuoprXlTWupU/oe3ZaPOqjs+BfmgYF0VmI5KAKfuvEcZVVPkj0x8EveE8spKKl7 AgVqnDeRoUiskNSvrEH4WvLVk9+Tb67oQYaXkHWIgTA/bmnufeCmFJAXRBRLzkCu72sIULcHb JIulfTf4GpkmkganRQPP65NPvAg0eI1pervgaGUJeowWL3fIx3S+divqDeZ/80lKhVo9KwX2v mh6b6XM96CyNjfLfDwgdcXq7hqvAGcy38rYDZIE06zOmhMZYbk+RqAhZCy0qRQlAQqPkvK/1w 6ZiNOMulNe+dHVSYCNnlJfxQ+Q8= Use the standard parameterized message for reporting incompatible options for worktree add. This reduces the number of strings to translate and makes the UI slightly more consistent. Signed-off-by: René Scharfe --- builtin/worktree.c | 17 +++++++++-------- t/t2400-worktree-add.sh | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) -- 2.43.0 diff --git a/builtin/worktree.c b/builtin/worktree.c index 62b7e26f4b..036ceaa981 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -730,11 +730,11 @@ static int dwim_orphan(const struct add_opts *opts, int opt_track, int remote) } if (opt_track) { - die(_("'%s' and '%s' cannot be used together"), "--orphan", - "--track"); + die(_("options '%s' and '%s' cannot be used together"), + "--orphan", "--track"); } else if (!opts->checkout) { - die(_("'%s' and '%s' cannot be used together"), "--orphan", - "--no-checkout"); + die(_("options '%s' and '%s' cannot be used together"), + "--orphan", "--no-checkout"); } return 1; } @@ -806,13 +806,14 @@ static int add(int ac, const char **av, const char *prefix) if (!!opts.detach + !!new_branch + !!new_branch_force > 1) die(_("options '%s', '%s', and '%s' cannot be used together"), "-b", "-B", "--detach"); if (opts.detach && opts.orphan) - die(_("options '%s', and '%s' cannot be used together"), + die(_("options '%s' and '%s' cannot be used together"), "--orphan", "--detach"); if (opts.orphan && opt_track) - die(_("'%s' and '%s' cannot be used together"), "--orphan", "--track"); + die(_("options '%s' and '%s' cannot be used together"), + "--orphan", "--track"); if (opts.orphan && !opts.checkout) - die(_("'%s' and '%s' cannot be used together"), "--orphan", - "--no-checkout"); + die(_("options '%s' and '%s' cannot be used together"), + "--orphan", "--no-checkout"); if (opts.orphan && ac == 2) die(_("'%s' and '%s' cannot be used together"), "--orphan", _("")); diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh index df4aff7825..245656b53a 100755 --- a/t/t2400-worktree-add.sh +++ b/t/t2400-worktree-add.sh @@ -711,7 +711,7 @@ test_dwim_orphan () { local fetch_error_text="fatal: No local or remote refs exist despite at least one remote" && local orphan_hint="hint: If you meant to create a worktree containing a new orphan branch" && local invalid_ref_regex="^fatal: invalid reference: " && - local bad_combo_regex="^fatal: '[-a-z]*' and '[-a-z]*' cannot be used together" && + local bad_combo_regex="^fatal: options '[-a-z]*' and '[-a-z]*' cannot be used together" && local git_ns="repo" && local dashc_args="-C $git_ns" && From patchwork Wed Dec 6 11:52:01 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: 13481693 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=l.s.r@web.de header.b="m7l83zFs" Received: from mout.web.de (mout.web.de [217.72.192.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F152269A for ; Wed, 6 Dec 2023 03:52:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1701863537; x=1702468337; i=l.s.r@web.de; bh=ZjTO4m2XZnz8HmheCJ3mZc9osciZFPGJTzTsDeKAfKQ=; h=X-UI-Sender-Class:From:To:Subject:Date:In-Reply-To:References; b=m7l83zFsUCy/+kJ1MhL/jnu5l/8vYfeSag1xz5kNGzjQXuG0/VGL2FYR5sbs0emI dy9pVuFqVwc4rUAuEnxNiBrJEf0bxVr4Y9HUyr4z1mycX4g8NHT7ZWrqHGoVw4uBK BU3XomsEtv6hHYyliUnSviX/1dMM/GmNYVxznHeE2p7GoQ1QHemsGuSn3WBoY7V3u 2lihdeTmJmRS35bxRmdWtGMuTs6GCk9MVfcZxK9lbSc56ooN1AuqmUpeeJEHPM/2Y X6MFVnS25g7aPaC2ZflnSyUQQBwv/WJlMv9B0EbY6TnjDzPMIXLVjWsudspY121+o 84PXy1iL4/TaK4sOTw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from Mini-von-Rene.fritz.box ([79.203.29.38]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MDvDi-1r37Cv19CW-009vyH for ; Wed, 06 Dec 2023 12:52:17 +0100 From: =?utf-8?q?Ren=C3=A9_Scharfe?= To: git@vger.kernel.org Subject: [PATCH 7/7] worktree: simplify incompatibility message for --orphan and commit-ish Date: Wed, 6 Dec 2023 12:52:01 +0100 Message-ID: <20231206115215.94467-8-l.s.r@web.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206115215.94467-1-l.s.r@web.de> References: <20231206115215.94467-1-l.s.r@web.de> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:MXw5SHVEKCJRAivH1HK94ENkYaWT47zMzN6PwvK3yvxMZyQGpgx LBcYY2D6e8rL0SGeI16Gh3mniwMH/faHayhjkO5UuJJBbas+akJOG615o4U9SsZjUfkFU3q xIBDwKoOVH1CLSDBSrlAfXo+FJg+8iKYeA8bNM+5WrG2DJJ0bTd/7PDvQa5CBdCYqj+KOsG bQt7aCV7EYbZ0WWcVrFfQ== UI-OutboundReport: notjunk:1;M01:P0:yeMB4ASYTTc=;Lohk/+lB6yeFvJGwYWpl9+ut4Zs FPEfrli4gJOmWchsHdTUTLNz5Rrbh1Xi6RrFlgG2+SWCw0DKB1WtOxMTjFzx4gYMH6M668rGz uZcMMZyHEfqgvnpGPxSmreGIiP6yjfaK4/Lg9mwa6nSnE95a7RDxKmhdJXbnAmDmoteM02pjz FsUMr64t1XKR3ySyGnSJuN/3JD4+qvPktC2gCS20s41tGaVB6o1SCB10+JQD1gFzIGTWJ3XkC 7/5HVPpfhrMcmjfdeH1aFjPLLwo/tIh4yGfL5L4L4oG/wldhJ28p/SH9iTD6Jx/TyllofKYqo u/GwTB58nJPFLqrlrAKEVrJtQ2Vy2XrBanGMe8y2OsqQHXfo0BhNnNrn5BUU0PxOHzLNQEQBq vRL+hP4uZWZuMSDwZNCVVm6GX6n8p5TPU1ww94x2v/lxfD07RGg7IRYUaVMsMKlSA0xUX769x +GFqtAjL/BUGzvdAZHyWX9G9rcCFTlj4i9e3yRCGLnnSb7dxA7QpXprGKKFViPm4cKDb+nYhs uNSP71VENx/G3SffGSqFGO7uTrHez0b9vlayB+vbJUlf6uLWXx8AP95oow6XG+vcPKf/71b6x 3v8KaIN602CTK6DjUKBXt3AlvBsxJmScl3Cra3AK1/CiVdQtv3jkCwJnx+grg3b0cY+Q3BfRP 0yDELnrf1Strdp9G3l0DRFWfEMwvyw6OUpiES0QyIDPDBeZknyaRk/7t5j9wCxe7nMu8RUdge jnGrcNB9MNlyKNxxI+tcfRIBhcjZUFABz6aBKKWTLXjGclW24G6/ugRtNIM2JN6W0skhP53fL 823Sf58xnZakkljB2RK/mb1DqBOVtdvorX4vkXh3Q9yHFGygdnEMeEWf1GmHhMzuG6bEA58kk 4xWQaGL+7bkULhA6iF7dpelZMA9j8Ds+qUrnF922+PpLod3n61QQtCbSHEXey836sPpvOAWJg BvFwKFEMUO0wo4j/I0eisUE7RoM= Use a single translatable string to report that the worktree add option --orphan is incompatible with a commit-ish instead of having the commit-ish in a separate translatable string. This reduces the number of strings to translate and gives translators the full context. A similar message is used in builtin/describe.c, but with the plural of commit-ish, and here we need the singular form. Signed-off-by: René Scharfe --- builtin/worktree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.43.0 diff --git a/builtin/worktree.c b/builtin/worktree.c index 036ceaa981..4ac1621541 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -815,8 +815,8 @@ static int add(int ac, const char **av, const char *prefix) die(_("options '%s' and '%s' cannot be used together"), "--orphan", "--no-checkout"); if (opts.orphan && ac == 2) - die(_("'%s' and '%s' cannot be used together"), "--orphan", - _("")); + die(_("option '%s' and commit-ish cannot be used together"), + "--orphan"); if (lock_reason && !keep_locked) die(_("the option '%s' requires '%s'"), "--reason", "--lock"); if (lock_reason)