From: Phil Hord <hordp@cisco.com>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: David Chanters <david.chanters@googlemail.com>, git@vger.kernel.org
Subject: Re: git-grep to operate across who repository and not just CWD?
Date: Mon, 28 Feb 2011 17:25:58 -0500 [thread overview]
Message-ID: <4D6C20F6.3070905@cisco.com> (raw)
In-Reply-To: <4D6B6A8B.20709@drmicha.warpmail.net>
(cc list: Pardon this duplicate attempt)
On 02/28/2011 04:27 AM, Michael J Gruber wrote:
> David Chanters venit, vidit, dixit 28.02.2011 01:17:
>> > Hi all,
>> >
>> > [ Please Cc me as I am not subscribed to this list, thanks. ]
>> >
>> > I'm wondering if there's an easy way to get git-grep (and I suppose
>> > other commands which operate on a per-repository level rather than
>> > per-tree) to work across the whole repository?
> git grep -- $(git rev-parse --show-cdup)
>
> is the best we have right now. I think we're still looking for a good
> way to denote "root of repo" (like "." for cwd).
>
> Also, we're thinking of changing a few defaults (to repo-wide), but "git
> grep" is meant to stay close to ordinary grep.
But git grep is different than grep in exactly the "files selection"
area. With grep, I always have to specify the files to search. With
git-grep, I don't.
Oridinary grep with no paths fails (reads stdin), so when I make this
mistake it is always immediately evident. I retry the command with
paths/wildcards. But git-grep with no path "works" and I am likely to
forget that it worked only on my $PWD.
git-grep also includes subdirectories and excludes untracked files by
default. This makes git-grep feel like the "repository grep" tool that
it is. The fact that it does _not_ search from the top of the repository
by default seems (to me) to be the only oddball case.
I would be much more comfortable with David's proposed option turned on
always. When I want to search "here", I can add a dot.
git grep foo # search the whole repository
git grep foo -- . # Search only from $PWD
Maybe it's dangerous as an always-on option, as it can break scripts.
And I'd be happy-ish even with a --full-tree option. But I think I
would eventually alias it so it always does what I expect.
I know that's not what the original question was, but it's the behavior
I often erroneously expect.
Thoughts?
Phil
next prev parent reply other threads:[~2011-02-28 22:35 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-28 0:17 git-grep to operate across who repository and not just CWD? David Chanters
2011-02-28 9:27 ` Michael J Gruber
2011-02-28 15:27 ` Jay Soffian
2011-02-28 18:32 ` Junio C Hamano
2011-02-28 18:38 ` Junio C Hamano
2011-02-28 22:25 ` Phil Hord [this message]
2011-03-01 8:05 ` Michael J Gruber
2011-03-01 8:16 ` Nguyen Thai Ngoc Duy
2011-03-01 8:54 ` Michael J Gruber
2011-03-01 9:32 ` Nguyen Thai Ngoc Duy
2011-03-01 9:44 ` Nguyen Thai Ngoc Duy
2011-03-01 9:53 ` [PATCH/POC 0/2] grep --full-tree Michael J Gruber
2011-03-01 9:53 ` [PATCH/RFC 1/2] grep: --full-tree Michael J Gruber
2011-03-01 9:53 ` [PATCH/RFC 2/2] grep: make --full-tree work with pathspecs Michael J Gruber
2011-03-01 19:20 ` Junio C Hamano
2011-03-01 10:21 ` [PATCH/alternative/raw and rough] setup.c: denote repo wide pathspecs by ':' Michael J Gruber
2011-03-01 11:13 ` Nguyen Thai Ngoc Duy
2011-03-01 11:16 ` Michael J Gruber
2011-03-01 11:50 ` Nguyen Thai Ngoc Duy
2011-03-01 11:57 ` Michael J Gruber
2011-03-01 12:08 ` Nguyen Thai Ngoc Duy
2011-03-01 14:50 ` Junio C Hamano
2011-03-01 15:01 ` Michael J Gruber
2011-03-01 20:00 ` Junio C Hamano
2011-03-02 12:34 ` Sverre Rabbelier
2011-03-02 12:57 ` Nguyen Thai Ngoc Duy
2011-03-02 13:12 ` Michael J Gruber
2011-03-02 16:53 ` Junio C Hamano
2011-03-02 17:31 ` Michael J Gruber
2011-03-03 2:42 ` Miles Bader
2011-03-03 3:52 ` Junio C Hamano
2011-03-03 3:44 ` Phil Hord
2011-03-03 8:20 ` Michael J Gruber
2011-03-01 16:25 ` Phil Hord
2011-03-01 18:31 ` James Pickens
2011-03-02 0:12 ` Nguyen Thai Ngoc Duy
2011-03-03 3:51 ` Phil Hord
2011-03-03 8:21 ` Michael J Gruber
2011-03-01 11:49 ` Michael J Gruber
2011-03-01 13:05 ` Phil Hord
2011-03-23 15:32 ` [PATCH] pathspec: reserve some letters after a colon pathspec Nguyễn Thái Ngọc Duy
2011-03-23 18:04 ` Junio C Hamano
2011-03-24 7:15 ` Michael J Gruber
2011-03-24 7:49 ` Nguyen Thai Ngoc Duy
2011-03-24 8:12 ` Junio C Hamano
2011-03-24 14:46 ` Junio C Hamano
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=4D6C20F6.3070905@cisco.com \
--to=hordp@cisco.com \
--cc=david.chanters@googlemail.com \
--cc=git@drmicha.warpmail.net \
--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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.