From: Junio C Hamano <gitster@pobox.com>
To: Ed Avis <ed.avis@qmaw.com>
Cc: "git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Feature request: 'git grep' over multiple working trees
Date: Tue, 24 Mar 2020 11:40:09 -0700 [thread overview]
Message-ID: <xmqq369x38c6.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <MN2PR11MB3663C042590097D7A7F4B2409DF10@MN2PR11MB3663.namprd11.prod.outlook.com> (Ed Avis's message of "Tue, 24 Mar 2020 07:49:13 +0000")
Ed Avis <ed.avis@qmaw.com> writes:
> If the current directory contains several git working trees (each
> in its own subdirectory) then 'git grep' should search all of
> them. It would be roughly equivalent to
>
> % for i in * ; do (cd $i ; git grep whatever); done
>
> except that the filenames listed would have the full path.
I am not sure where that "should search" comes from.
In my $HOME/w directory, I have working trees of various
repositories, belonging to different and unrelated projects.
Should "git grep foo" in there search in everywhre?
Are you looking for "grep -r --exclude=.git" (not a git command at
all)?
In other words, surely anybody can wish anything nonsensical, but I
do not quite see the point for adding such a mode to "Git".
It sounds like saying 'git grep' "should" search all of them if the
current directly is a git repository with several git commits, which
would be roughly equivalent to
git rev-list --all |
while read rev
do
git grep -e pattern... $rev
done
Similarly, you could say that 'git grep' "should" search all of them
if the current directory is a git repository with several branches,
which would be roughly equivalent to
git for-each-ref --format='%(objectname)' refs/heads/ |
while read rev
do
git grep -e pattern... $rev
done
Neither of the above smell like a reasonable use of "should", at
least to me, and yours does not, either.
What is the real use case, if any, of what you are proposing?
next prev parent reply other threads:[~2020-03-24 18:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-24 7:49 Feature request: 'git grep' over multiple working trees Ed Avis
2020-03-24 18:40 ` Junio C Hamano [this message]
2020-03-25 8:04 ` Ed Avis
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq369x38c6.fsf@gitster.c.googlers.com \
--to=gitster@pobox.com \
--cc=ed.avis@qmaw.com \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).