[PATCH v2 0/1] Long names for `git log -S` and `git log -G`
- From
Illia Bobyr <illia.bobyr@gmail.com>
- Date
- Feb 5, 2025, 02:24 UTC
- Message-ID
- <20250205022422.2019929-1-illia.bobyr@gmail.com>
- In-Reply-To
- <xmqqserjsfrq.fsf@gitster.g>
Sorry, I dropped the ball on this. I still think it would be good to get it done.
Show 17 quoted lines
> On 11/22/24 02:51, 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" > > Ahh, "modifies" is a great verb. It sounds quite logical, but "-S" > does not have to generate a patch internally for it to work, so > "--patch-modifies" is a bit of white lie.
Used "--patch-modifies" for the second version of the patch.
I think most people (certainly me) think about patches first, when they look at these commands. They are unlikely to realize right away that generating a patch is more expensive than counting the string/regex occurrences in the pre- and post- images. So, if you consider the "it behaves as if" point of view rather than "this is how it works" point of view, it is not even a lie :)
Show 6 quoted lines
> > "--patch-search-show-all"/"--patch-show-all" for "--pickaxe-all" > > "--patch-search-regex"/"--patch-regex" for "--pickaxe-regex" > > These already have their own established long names, so it is > outside the scope of this topic, and I doubt it is worth giving > these additional aliases (as you seem to agree).
I do not have a strong feeling on this one. If "-S" and/or "-G" would get names that do not start with a "--pickaxe" it might be a bit confusing that the flags that affect their behavior do have the "--pickaxe" prefix. If this is a valid concern, I could probably create a separate patch to add alternative names.
---
I've updated the patch with the following names:
"--patch-grep" for "-G" "--patch-modifies" for "-S"
On 11/19/24 10:58, Jeff King wrote:
> 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".
Is "--patch-grep" a good alternative? I think, using the same prefix for a functionality that looks quite similar from the user standpoint ("-G" and "-S") seems nice. Using "--grep-in-patch" for "-G", "--patch-modifies" for "-S" and "--pickaxe-regex"/"--pickaxe-all" all at the same time seems less consistent, but I can change it if you insist.
Illia Bobyr (1):
diff: --patch{-modifies,grep} arg names for -S and -GDocumentation/diff-options.txt | 36 +++++------ Documentation/git-blame.txt | 2 +- Documentation/gitdiffcore.txt | 48 ++++++++------- diff.c | 18 +++--- diff.h | 11 +++- gitk-git/gitk | 10 +++- t/t4062-diff-pickaxe.sh | 8 +-- t/t4209-log-pickaxe.sh | 106 +++++++++++++++++++++++---------- 8 files changed, 151 insertions(+), 88 deletions(-)
-- 2.45.2