* Change the grep command called by git with alternative tools, such as ug.
@ 2025-01-02 11:48 Hongyi Zhao
2025-01-02 13:00 ` Matěj Cepl
0 siblings, 1 reply; 5+ messages in thread
From: Hongyi Zhao @ 2025-01-02 11:48 UTC (permalink / raw)
To: Git List
Hi there,
Can I change the grep command called by git with alternative tools,
such as ug [1]?
Say in the following command:
$ git grep -i jobflow
I tried to replace grep with ug, but failed as follows:
$ git ug -i jobflow
git: 'ug' is not a git command. See 'git --help'.
The most similar command is
gui
[1] https://github.com/Genivia/ugrep
Regards,
Zhao
--
Assoc. Prof. Hongsheng Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Change the grep command called by git with alternative tools, such as ug.
2025-01-02 11:48 Change the grep command called by git with alternative tools, such as ug Hongyi Zhao
@ 2025-01-02 13:00 ` Matěj Cepl
2025-01-02 13:39 ` Hongyi Zhao
0 siblings, 1 reply; 5+ messages in thread
From: Matěj Cepl @ 2025-01-02 13:00 UTC (permalink / raw)
To: Hongyi Zhao, Git List
On Thu Jan 2, 2025 at 12:49 PM CET, Hongyi Zhao wrote:
> $ git grep -i jobflow
>
> I tried to replace grep with ug, but failed as follows:
AFAIK, git grep doesn’t use external grep(1) binary on its
own, but rather it uses its own (and slightly different)
algorithm. Certainly, calling git-ug (or git-rg) will do
absolutely nothing as long as you have no git-ug binary in your
$PATH.
Best,
Matěj
--
http://matej.ceplovi.cz/blog/, @mcepl@en.osm.town
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8
When God put a calling on your life, He already factored in your
stupidity.
-- Unknown, mentioned in a sermon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Change the grep command called by git with alternative tools, such as ug.
2025-01-02 13:00 ` Matěj Cepl
@ 2025-01-02 13:39 ` Hongyi Zhao
2025-01-02 14:57 ` Matěj Cepl
0 siblings, 1 reply; 5+ messages in thread
From: Hongyi Zhao @ 2025-01-02 13:39 UTC (permalink / raw)
To: Matěj Cepl; +Cc: Git List
On Thu, Jan 2, 2025 at 9:00 PM Matěj Cepl <mcepl@cepl.eu> wrote:
>
> On Thu Jan 2, 2025 at 12:49 PM CET, Hongyi Zhao wrote:
> > $ git grep -i jobflow
> >
> > I tried to replace grep with ug, but failed as follows:
>
> AFAIK, git grep doesn’t use external grep(1) binary on its
> own, but rather it uses its own (and slightly different)
> algorithm. Certainly, calling git-ug (or git-rg) will do
> absolutely nothing as long as you have no git-ug binary in your
> $PATH.
Do you mean: by linking ug as git-ug will do the trick?
> Best,
>
> Matěj
Zhao
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Change the grep command called by git with alternative tools, such as ug.
2025-01-02 13:39 ` Hongyi Zhao
@ 2025-01-02 14:57 ` Matěj Cepl
2025-01-02 15:28 ` Jonathan Nieder
0 siblings, 1 reply; 5+ messages in thread
From: Matěj Cepl @ 2025-01-02 14:57 UTC (permalink / raw)
To: Hongyi Zhao; +Cc: Git List
On Thu Jan 2, 2025 at 2:39 PM CET, Hongyi Zhao wrote:
> Do you mean: by linking ug as git-ug will do the trick?
No, you would have to rewrite git-grep to use external grep-like
program. I am not sure whether there isn’t such project already
out there.
Best,
Matěj
--
http://matej.ceplovi.cz/blog/, @mcepl@en.osm.town
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8
To the well-organized mind, death is but the next great adventure.
-- Albus Dumbledore
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Change the grep command called by git with alternative tools, such as ug.
2025-01-02 14:57 ` Matěj Cepl
@ 2025-01-02 15:28 ` Jonathan Nieder
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Nieder @ 2025-01-02 15:28 UTC (permalink / raw)
To: Matěj Cepl; +Cc: Hongyi Zhao, Git List
Hi,
Matěj Cepl wrote:
> On Thu Jan 2, 2025 at 2:39 PM CET, Hongyi Zhao wrote:
>> Do you mean: by linking ug as git-ug will do the trick?
>
> No, you would have to rewrite git-grep to use external grep-like
> program. I am not sure whether there isn’t such project already
> out there.
The key question is - what are you trying to do? "git grep" is able
to search inside historical commits, the working copy, the index, and
so on. Do we want to search in the same way to find files with hits
(for efficiency reasons, for example) and then use an external program
to find the matches within those files? For that kind of application
I might do some scripting around "git grep --name-only", but I can
also imagine that your application is different. Depending on the
goal, it could be something a git command already supports, an implied
feature request for git, or something that the external search tool
might need to learn.
In other words, Matěj's reply is spot on in describing the current
behavior: "git grep" doesn't call out to an external grep tool. But
as for the desired behavior, we'd need to know more about the use case
to figure it out.
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-02 15:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-02 11:48 Change the grep command called by git with alternative tools, such as ug Hongyi Zhao
2025-01-02 13:00 ` Matěj Cepl
2025-01-02 13:39 ` Hongyi Zhao
2025-01-02 14:57 ` Matěj Cepl
2025-01-02 15:28 ` Jonathan Nieder
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).