From: Illia Bobyr <illia.bobyr@gmail.com>
To: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Long names for `git log -S` and `git log -G`
Date: Thu, 21 Nov 2024 15:31:00 -0800 [thread overview]
Message-ID: <470fe577-b26d-4393-8fa6-8f73ca4302de@gmail.com> (raw)
In-Reply-To: <20241119185817.GC15723@coredump.intra.peff.net>
On 11/18/24 19:52, Junio C Hamano wrote:
>> `--pickaxe-grep` for `-G` seems like a reasonable alternative name for `-G`.
> That is probably OK (even though "-G" is not exactly what the
> pickaxe machinery wants to do; "--grep-in-patch" might be closer to
> the intent).
Imagining, that I am starting from scratch for this functionality, I think I
would also consider "patch". Though, as we have 4 related argument names, I
wonder if using it as a prefix would create a more consistent UX.
Something like:
"--patch-grep" for "-G"
"--patch-modifies" for "-S"
"--patch-search-show-all"/"--patch-show-all" for "--pickaxe-all"
"--patch-search-regex"/"--patch-regex" for "--pickaxe-regex"
I'm not too sure about the later two, and also they already have long names.
But it seems quite easy to understand what this command would do:
git log --patch-grep sometext ...
Or this
git log --patch-modifies function_call --patch-search-regex ...
>> Not sure what would be a reasonably short alternative for `-S`.
>> `--pickaxe-occurance-change` seems too long, and might not be as clear.
>> `--pickaxe-occurance-count-change` is just way too long.
> Giving a tool a meaningful name is an excellent idea. If the
> meaningful name guides users to the right way to use the tool,
> it would be ideal. Which means that to name it right, you'd need to
> know what it exactly is for.
Glad we are on the same page here :)
I would really appreciate yours and Jeff input.
I wrote a simple patch to see how much work is it to add long names [1].
But I would change it based on whatever names are agreed upon.
[1]:
https://lore.kernel.org/git/20241119032755.3360365-1-illia.bobyr@gmail.com/
> The -S feature was written to become one of the building blocks of
> Linus's "clearly superior algorithm", described in [1]. Linus talks
> about "where did this _line_ come from?", but the algorithm is more
> generally about a block of code. The expected use case is for -S to
> be fed sufficiently unique block of text so that we can efficiently
> detect the transition of occurence count from 1 (because wee start
> from sufficiently unique block of code) down to 0 (which is the
> boundary in history where the block of code was first introduced in
> its current form). It detects any occurence count change, but its
> primary focus is to find a transition from 1 to 0 (when going
> backwards in history). Its spirit is more about "finding where it
> appeared in its current shape".
>
>
> [Footnote]
>
> *1* https://lore.kernel.org/git/Pine.LNX.4.58.0504150753440.7211@ppc970.osdl.org/
This is pretty interesting. Thank you for pointing it out. I guess, it
means
that the "counting" in the porposed long name of "-S" arguments is more
of an
implementation detail than the actually intended functionality. Do you
think
there is a word that better reflects the intent here? "--patch-modifies" is
probably also not really hitting it 100%.
On 11/19/24 10:58, Jeff King wrote:
> On Tue, Nov 19, 2024 at 12:52:50PM +0900, Junio C Hamano wrote:
>>> `--pickaxe-grep` for `-G` seems like a reasonable alternative name for `-G`.
>> That is probably OK (even though "-G" is not exactly what the
>> pickaxe machinery wants to do; "--grep-in-patch" might be closer to
>> the intent).
> FWIW, I like --grep-in-patch. Saying just "--pickaxe-grep" does not
> highlight that it is about looking in the patch. I.e., it is not clear
> from the name that is different from "-Sfoo --pickaxe-regex".
I agree. Do you think "--patch-grep" is a better name? Or do you think
that
the grep and the occurrence counting functionality should not share a common
prefix, as they are somewhat different in nature?
"git log" docs talk about both "-S" and "-G" as if they are pretty
close. There
is a note in "git diffcore" doc, "diff-pickaxe" section that says that
grep is
actually quite different. I wonder if this is important for the users
to think
about. I often use "-G" followed by "-S" or the other way around, just
to see
which view is better for my particular problem.
next prev parent reply other threads:[~2024-11-21 23:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 23:56 Long names for `git log -S` and `git log -G` Illia Bobyr
2024-11-19 3:52 ` Junio C Hamano
2024-11-19 18:58 ` Jeff King
2024-11-21 23:31 ` Illia Bobyr [this message]
2024-11-22 10:51 ` Junio C Hamano
2025-02-05 2:24 ` [PATCH v2 0/1] " Illia Bobyr
2025-02-05 2:24 ` [PATCH v2 1/1] diff: --patch{-modifies,grep} arg names for -S and -G Illia Bobyr
2025-02-05 7:15 ` Johannes Sixt
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=470fe577-b26d-4393-8fa6-8f73ca4302de@gmail.com \
--to=illia.bobyr@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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).