summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 12a258c)
raw | patch | inline | side by side (parent: 12a258c)
author | Junio C Hamano <gitster@pobox.com> | |
Thu, 28 Jan 2010 20:33:42 +0000 (12:33 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 28 Jan 2010 20:33:42 +0000 (12:33 -0800) |
Name the option "--quiet" not "--quick", document it, and add tests.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-grep.txt | patch | blob | history | |
builtin-grep.c | patch | blob | history | |
t/t7002-grep.sh | patch | blob | history |
index abb6735a40a2b7a9ea893c6c7e3c5e967cd1f2ea..e019e760b4b4d58dfbe8819941947008319aedac 100644 (file)
[-F | --fixed-strings] [-n]
[-l | --files-with-matches] [-L | --files-without-match]
[-z | --null]
- [-c | --count] [--all-match]
+ [-c | --count] [--all-match] [-q | --quiet]
[--max-depth <depth>]
[--color | --no-color]
[-A <post-context>] [-B <pre-context>] [-C <context>]
this flag is specified to limit the match to files that
have lines to match all of them.
+-q::
+--quiet::
+ Do not output matched lines; instead, exit with status 0 when
+ there is a match and with non-zero status when there isn't.
+
`<tree>...`::
Search blobs in the trees for specified patterns.
diff --git a/builtin-grep.c b/builtin-grep.c
index 6cc743d7c585fa443f18a700455a4da662dec49f..9bd467c9b90d1c58a59e27fbc6673cb68d855c72 100644 (file)
--- a/builtin-grep.c
+++ b/builtin-grep.c
{ OPTION_CALLBACK, ')', NULL, &opt, NULL, "",
PARSE_OPT_NOARG | PARSE_OPT_NONEG | PARSE_OPT_NODASH,
close_callback },
- OPT_BOOLEAN('q', "quick", &opt.status_only,
+ OPT_BOOLEAN('q', "quiet", &opt.status_only,
"indicate hit with exit status without output"),
OPT_BOOLEAN(0, "all-match", &opt.all_match,
"show only matches from files that match all patterns"),
diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh
index 7eceb086bee2f0b5c59341256b506775c21941e7..bf4d4dcb2bc577715a02ae01f95a5be348e40384 100755 (executable)
--- a/t/t7002-grep.sh
+++ b/t/t7002-grep.sh
z:zzz
EOF
+test_expect_success 'grep -q, silently report matches' '
+ >empty &&
+ git grep -q mmap >actual &&
+ test_cmp empty actual &&
+ test_must_fail git grep -q qfwfq >actual &&
+ test_cmp empty actual
+'
+
# Create 1024 file names that sort between "y" and "z" to make sure
# the two files are handled by different calls to an external grep.
# This depends on MAXARGS in builtin-grep.c being 1024 or less.