From: Mark Lodato <lodatom@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Mark Lodato <lodatom@gmail.com>
Subject: [PATCHv2] grep documentation: clarify what files match
Date: Mon, 15 Feb 2010 19:25:40 -0500 [thread overview]
Message-ID: <1266279940-13251-1-git-send-email-lodatom@gmail.com> (raw)
In-Reply-To: <7vvddz5l1z.fsf@alter.siamese.dyndns.org>
Clarify that git-grep(1) searches only tracked files, and that each
<path> is a glob, as in git-add(1). Add an example to show a simple use
case for searching all .c and .h files.
The meta-variable <path> should be changed to an official term for
a path glob, and the description for this should be in git(1), not
git-add(1). However, we don't yet have such an official term, so just
use <path> and reference git-add(1) for now.
Signed-off-by: Mark Lodato <lodatom@gmail.com>
---
Documentation/git-grep.txt | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index e019e76..7f24032 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -26,8 +26,8 @@ SYNOPSIS
DESCRIPTION
-----------
-Look for specified patterns in the working tree files, blobs
-registered in the index file, or given tree objects.
+Look for specified patterns in the tracked files in the working tree, blobs
+registered in the index file, or blobs in given tree objects.
OPTIONS
@@ -49,7 +49,7 @@ OPTIONS
Don't match the pattern in binary files.
--max-depth <depth>::
- For each pathspec given on command line, descend at most <depth>
+ For each <path> given on command line, descend at most <depth>
levels of directories. A negative value means no limit.
-w::
@@ -170,10 +170,17 @@ OPTIONS
Signals the end of options; the rest of the parameters
are <path> limiters.
+<path>...::
+ If given, limit the search to paths matching at least one pattern.
+ Each pattern is the same as <filepattern> of linkgit:git-add[1].
Example
-------
+git grep 'time_t' -- '*.[ch]'::
+ Looks for `time_t` in all tracked .c and .h files in the working
+ directory.
+
git grep -e \'#define\' --and \( -e MAX_PATH -e PATH_MAX \)::
Looks for a line that has `#define` and either `MAX_PATH` or
`PATH_MAX`.
--
1.7.0
next prev parent reply other threads:[~2010-02-16 0:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-15 0:35 git-grep ignores untracked files Mark Lodato
2010-02-15 1:45 ` Junio C Hamano
2010-02-16 0:20 ` Mark Lodato
2010-02-16 0:25 ` Mark Lodato [this message]
2010-02-16 2:03 ` [PATCHv2] grep documentation: clarify what files match 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=1266279940-13251-1-git-send-email-lodatom@gmail.com \
--to=lodatom@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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 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).