@matheusbsbs / matheus-bagliano / commits / fba0cbd95d
Fork 0

git-grep: document --and, --or, --not, ( and )

[jc: added an example section.] Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Matthias Lederhofer committed Aug 3, 2006 at 00:04 UTC fba0cbd95d796857622d642160176907930ae511
1 file changed +17 -3
Documentation/git-grep.txt
+17 -3
@@ -16,7 +16,7 @@ SYNOPSIS
16 [-n] [-l | --files-with-matches] [-L | --files-without-match]
17 [-c | --count]
18 [-A <post-context>] [-B <pre-context>] [-C <context>]
19 - [-f <file>] [-e] <pattern>
19 + [-f <file>] [-e] <pattern> [--and|--or|--not|(|)|-e <pattern>...]
20 [<tree>...]
21 [--] [<path>...]
22
@@ -74,16 +74,30 @@ OPTIONS
74 -e::
75 The next parameter is the pattern. This option has to be
76 used for patterns starting with - and should be used in
77 - scripts passing user input to grep.
77 + scripts passing user input to grep. Multiple patterns are
78 + combined by 'or'.
79 +
80 +--and | --or | --not | ( | )::
81 + Specify how multiple patterns are combined using boolean
82 + expressions. `--or` is the default operator. `--and` has
83 + higher precedence than `--or`. `-e` has to be used for all
84 + patterns.
85
86 `<tree>...`::
87 Search blobs in the trees for specified patterns.
88
82 -`--`::
89 +\--::
90 Signals the end of options; the rest of the parameters
91 are <path> limiters.
92
93
94 +Example
95 +-------
96 +
97 +git grep -e \'#define\' --and \( -e MAX_PATH -e PATH_MAX \)::
98 + Looks for a line that has `#define` and either `MAX_PATH` or
99 + `PATH_MAX`.
100 +
101 Author
102 ------
103 Originally written by Linus Torvalds <torvalds@osdl.org>, later