From: Jeff King <peff@peff.net>
To: Thiago Farina <tfransosi@gmail.com>
Cc: "Josh Hagins" <hagins.josh@gmail.com>,
"Git Mailing List" <git@vger.kernel.org>,
"Duy Nguyễn" <pclouds@gmail.com>
Subject: Re: multiple source file extensions
Date: Mon, 4 May 2015 23:43:36 -0400 [thread overview]
Message-ID: <20150505034336.GA25194@peff.net> (raw)
In-Reply-To: <CACnwZYdGKcdzgu1=Ysd_pxqeuSBpZu41i1EJBvBi4FqHzvV-Hw@mail.gmail.com>
On Mon, May 04, 2015 at 07:12:45PM -0300, Thiago Farina wrote:
> On Fri, May 1, 2015 at 10:11 PM, Jeff King <peff@peff.net> wrote:
> > On Fri, May 01, 2015 at 08:49:14PM -0400, Josh Hagins wrote:
> >
> >> If you're using a recent version of bash, you could enable the
> >> 'globstar' option:
> >>
> >> $ shopt -s globstar
> >> $ git grep 'pattern' **/*.{cc,cpp,h}
> >>
> >> Does that work?
> >
> > That will only pick up files that are in the working tree. Which is fine
> > for a stock "git grep" with no options, but would not be right for
> > grepping in the index or an older tree. For that, you can ask git to
> > glob for you:
> >
> > git grep pattern -- '*.cc' '*.cpp' '*.h'
> >
> Is it possible to do a regex like the following?
>
> ".*\.[cChH]\(pp\)?"
No, pathspecs are globs, not regexps. I think the idea has been floated
for supporting regexps, which you would activate something like:
git grep pattern -- :(regexp)$your_regex_here
but nobody has implemented it. I'm not sure it actually saves you any
typing (besides which, your regexp does not match ".cc", which was in
the original).
-Peff
next prev parent reply other threads:[~2015-05-05 3:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-02 0:40 multiple source file extensions Thiago Farina
2015-05-02 0:49 ` Josh Hagins
2015-05-02 1:11 ` Jeff King
2015-05-02 2:04 ` Duy Nguyen
2015-05-02 2:11 ` Duy Nguyen
2015-05-02 2:35 ` Jeff King
2015-05-02 7:11 ` Eric Sunshine
2015-05-03 2:26 ` Junio C Hamano
2015-05-02 2:33 ` Jeff King
2015-05-04 22:12 ` Thiago Farina
2015-05-05 3:43 ` Jeff King [this message]
2015-05-05 17:30 ` Mikael Magnusson
2015-05-05 19:12 ` Jeff King
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=20150505034336.GA25194@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=hagins.josh@gmail.com \
--cc=pclouds@gmail.com \
--cc=tfransosi@gmail.com \
/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.