[PATCHv2] grep documentation: clarify what files match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]