From: Junio C Hamano <gitster@pobox.com>
To: Illia Bobyr <illia.bobyr@gmail.com>
Cc: Jeff King <peff@peff.net>, Johannes Sixt <j6t@kdbg.org>,
git@vger.kernel.org
Subject: Re: [PATCH v3 1/1] diff: --patch-{modifies,grep} arg names for -S and -G
Date: Thu, 06 Feb 2025 12:59:45 -0800 [thread overview]
Message-ID: <xmqqseoqiybi.fsf@gitster.g> (raw)
In-Reply-To: <20250206014324.1839232-2-illia.bobyr@gmail.com> (Illia Bobyr's message of "Wed, 5 Feb 2025 17:43:16 -0800")
Illia Bobyr <illia.bobyr@gmail.com> writes:
> Most arguments have both short and long versions. Long versions are
> easier to read, especially in scripts and command history.
>
> Tests that check just the option parsing are duplicated to check both
> short and long argument options. But more complex tests are updated to
> use the long argument in order to improve the test readability.
While checking both may be a prudent thing to do, because the "-S"
option and the "-G" option have been there with us almost since the
beginning of time, the swapping all existing use of them with the
longhand is rather unwelcome and needless churn, I would have to
say.
> `-S<string>`::
> +`--patch-modifies=<string>`::
Good. I am looking at 'git-commit.txt' as an example, and we seem
to give shorthand first and then longhand, which matches what we see
here.
> @@ -657,18 +658,19 @@ renamed entries cannot appear if detection for those types is disabled.
> It is useful when you're looking for an exact block of code (like a
> struct), and want to know the history of that block since it first
> came into being: use the feature iteratively to feed the interesting
> -block in the preimage back into `-S`, and keep going until you get the
> -very first version of the block.
> +block in the preimage back into `--patch-modifies`, and keep going until
> +you get the very first version of the block.
If this paragraph _were_ written with the longhand from the
beginning, I would not have minded too much, but I personally find
it unnecessary to churn the existing document like this.
> `-G<regex>`::
> +`--patch-grep=<regex>`::
Same two paragraphs from the above apply here, and ...
> `--find-object=<object-id>`::
> `--pickaxe-all`::
> `--pickaxe-regex`::
... all of the above.
> diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
Ditto.
> diff --git a/Documentation/gitdiffcore.txt b/Documentation/gitdiffcore.txt
> index 642c5..e4b18 100644
> --- a/Documentation/gitdiffcore.txt
> +++ b/Documentation/gitdiffcore.txt
> @@ -245,33 +245,35 @@ diffcore-pickaxe: For Detecting Addition/Deletion of Specified String
>
> This transformation limits the set of filepairs to those that change
> specified strings between the preimage and the postimage in a certain
> -way. -S<block-of-text> and -G<regular-expression> options are used to
> +way. --patch-modifies=<block-of-text> and
> +--patch-grep=<regular-expression> options are used to specify
> +different ways these strings are sought.
This is worse. Here is the first part that describes the pickaxe,
so mentioning both may be more appropriate; showing only the
longhand nobody is familiar with (yet) does not make any sense.
... certain way. `--patch-modifies=<block-of-text>`
(`-S<block-of-text>` for short) and `--patch-grep=<regular-expression>`
(`-G<regular-expression>` for short) are used to ...
Once establishing the equivalence between the longhand and the
shorthand for these two options, we do not have to churn the
existing text at all.
> diff --git a/diff.c b/diff.c
> index d28b41..09beb 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -4877,15 +4877,17 @@ void diff_setup_done(struct diff_options *options)
>
> if (HAS_MULTI_BITS(options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))
> die(_("options '%s', '%s', and '%s' cannot be used together"),
> - "-G", "-S", "--find-object");
> + "-G/--patch-grep", "-S/--patch-modifies", "--find-object");
>
> if (HAS_MULTI_BITS(options->pickaxe_opts & DIFF_PICKAXE_KINDS_G_REGEX_MASK))
> die(_("options '%s' and '%s' cannot be used together, use '%s' with '%s'"),
> - "-G", "--pickaxe-regex", "--pickaxe-regex", "-S");
> + "-G/--patch-grep", "--pickaxe-regex",
> + "--pickaxe-regex", "-S/--patch-modifies");
>
> if (HAS_MULTI_BITS(options->pickaxe_opts & DIFF_PICKAXE_KINDS_ALL_OBJFIND_MASK))
> die(_("options '%s' and '%s' cannot be used together, use '%s' with '%s' and '%s'"),
> - "--pickaxe-all", "--find-object", "--pickaxe-all", "-G", "-S");
> + "--pickaxe-all", "--find-object",
> + "--pickaxe-all", "-G/--patch-grep", "-S/--patch-modifies");
The message change looks fine; the indentation is broken.
.git/rebase-apply/patch:184: indent with spaces.
"--pickaxe-regex", "-S/--patch-modifies");
.git/rebase-apply/patch:190: indent with spaces.
"--pickaxe-all", "-G/--patch-grep", "-S/--patch-modifies");
warning: 2 lines applied after fixing whitespace errors.
Applying: diff: --patch-{modifies,grep} arg names for -S and -G
These alone do not require a new iteration, as "git am --whitespace=fix"
already corrected them.
> - OPT_CALLBACK_F('S', NULL, options, N_("<string>"),
> + OPT_CALLBACK_F('S', "patch-modifies", options, N_("<string>"),
> - OPT_CALLBACK_F('G', NULL, options, N_("<regex>"),
> + OPT_CALLBACK_F('G', "patch-grep", options, N_("<regex>"),
OK. NOte that this says <regex>. We may want to have a separate clean-up
patch so that Documentation/gitdifcore.txt that used <regular-expression>
and the placeholder used here match.
> - N_("look for differences that change the number of occurrences of the specified regex"),
> + N_("look for differences where a patch contains the specified regex"),
This is an unrelated change that should not be in this patch. If
you want to modify it, please do it in a separate clean-up patch,
just like the above <regex> vs <regular-expression> change.
> - N_("show all changes in the changeset with -S or -G"),
> + N_("show all changes in the changeset with -S/--patch-modifies or -G/--patch-grep"),
This line is meant to be shown when the user requests list of
options and their meanings. Growing the message from 47 columns or
so to 78 columns would make it wider than terminals when these
messages are indented. Because earlier entries in this array have
already established the equivalence between the shorthand and the
longhand, I do not think the output is understandable without this
change.
> OPT_BIT_F(0, "pickaxe-regex", &options->pickaxe_opts,
> - N_("treat <string> in -S as extended POSIX regular expression"),
> + N_("treat <string> in -S/--patch-modifies as extended POSIX regular expression"),
Ditto.
Thanks.
next prev parent reply other threads:[~2025-02-06 20:59 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 1:43 [PATCH v3 0/1] Long names for `git log -S` and `git log -G` Illia Bobyr
2025-02-06 1:43 ` [PATCH v3 1/1] diff: --patch-{modifies,grep} arg names for -S and -G Illia Bobyr
2025-02-06 20:59 ` Junio C Hamano [this message]
2025-02-12 3:26 ` Illia Bobyr
2025-02-12 17:08 ` Junio C Hamano
2025-02-06 13:04 ` [PATCH v3 0/1] Long names for `git log -S` and `git log -G` Junio C Hamano
2025-02-11 8:50 ` [PATCH v4 0/10] " Illia Bobyr
2025-02-11 18:07 ` Junio C Hamano
2025-02-12 3:28 ` Illia Bobyr
2025-02-11 8:50 ` [PATCH v4 01/10] t/t4209-log-pickaxe: Naming typo: -G takes a regex Illia Bobyr
2025-02-11 8:50 ` [PATCH v4 02/10] diff: -G description: Correct copy/paste error Illia Bobyr
2025-02-11 8:50 ` [PATCH v4 03/10] diff: short help: Correct -S description Illia Bobyr
2025-02-11 8:50 ` [PATCH v4 04/10] diff: short help: Add -G and --pickaxe-grep Illia Bobyr
2025-02-11 8:50 ` [PATCH v4 05/10] docs: gitdiffcore: -G and -S: Use regex/string placeholders Illia Bobyr
2025-02-11 8:50 ` [PATCH v4 06/10] diff: --patch-{grep,modifies} arg names for -G and -S Illia Bobyr
2025-02-11 8:50 ` [PATCH v4 07/10] completion: Support --patch-{grep,modifies} Illia Bobyr
2025-02-11 8:50 ` [PATCH v4 08/10] diff: test: Use --patch-{grep,modifies} over -G/-S Illia Bobyr
2025-02-11 8:50 ` [PATCH v4 09/10] diff: --pickaxe-{all,regex} help: Add --patch-{grep,modifies} Illia Bobyr
2025-02-11 8:50 ` [PATCH v4 10/10] diff: docs: Use --patch-{grep,modifies} over -G/-S Illia Bobyr
2025-02-12 3:26 ` [PATCH v5 00/10] Long names for `git log -S` and `git log -G` Illia Bobyr
2025-02-12 3:26 ` [PATCH v5 01/10] t/t4209-log-pickaxe: Naming typo: -G takes a regex Illia Bobyr
2025-02-13 4:06 ` Junio C Hamano
2025-02-12 3:26 ` [PATCH v5 02/10] diff: -G description: Correct copy/paste error Illia Bobyr
2025-02-13 4:16 ` Junio C Hamano
2025-02-12 3:26 ` [PATCH v5 03/10] diff: short help: Correct -S description Illia Bobyr
2025-02-13 4:26 ` Junio C Hamano
2025-02-12 3:26 ` [PATCH v5 04/10] diff: short help: Add -G and --pickaxe-grep Illia Bobyr
2025-02-12 3:26 ` [PATCH v5 05/10] docs: gitdiffcore: -G and -S: Use regex/string placeholders Illia Bobyr
2025-02-13 4:36 ` Junio C Hamano
2025-02-12 3:26 ` [PATCH v5 06/10] diff: --patch-{grep,modifies} arg names for -G and -S Illia Bobyr
2025-02-13 5:20 ` Junio C Hamano
2025-02-12 3:26 ` [PATCH v5 07/10] completion: Support --patch-{grep,modifies} Illia Bobyr
2025-02-13 5:46 ` Junio C Hamano
2025-02-12 3:26 ` [PATCH v5 08/10] diff: test: Use --patch-{grep,modifies} over -G/-S Illia Bobyr
2025-02-12 3:26 ` [PATCH v5 09/10] diff: --pickaxe-{all,regex} help: Add --patch-{grep,modifies} Illia Bobyr
2025-02-12 3:26 ` [PATCH v5 10/10] diff: docs: Use --patch-{grep,modifies} over -G/-S Illia Bobyr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqseoqiybi.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=illia.bobyr@gmail.com \
--cc=j6t@kdbg.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).