summaryrefslogtreecommitdiff
path: root/builtin/grep.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-10-19 04:34:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-10-19 04:34:06 (GMT)
commit9822b8f10d2c255c3bda81aa800fa056549f034a (patch)
tree85959ab31de49c7360745b67f14694a9a97ed2fd /builtin/grep.c
parent54e564e1d626fbcfb5eabddaccc9daf0aae6a9be (diff)
parent0a09e5edc281941b77dbf7aa3436781250d16088 (diff)
downloadgit-9822b8f10d2c255c3bda81aa800fa056549f034a.zip
git-9822b8f10d2c255c3bda81aa800fa056549f034a.tar.gz
git-9822b8f10d2c255c3bda81aa800fa056549f034a.tar.bz2
Merge branch 'rs/grep-no-recursive'
Unlike "grep", "git grep" by default recurses to the whole tree. The command learned "git grep --recursive" option, so that "git grep --no-recursive" can serve as a synonym to setting the max-depth to 0. * rs/grep-no-recursive: grep: add -r/--[no-]recursive
Diffstat (limited to 'builtin/grep.c')
-rw-r--r--builtin/grep.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index 0c35272..d8508dd 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -812,6 +812,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
GREP_BINARY_NOMATCH),
OPT_BOOL(0, "textconv", &opt.allow_textconv,
N_("process binary files with textconv filters")),
+ OPT_SET_INT('r', "recursive", &opt.max_depth,
+ N_("search in subdirectories (default)"), -1),
{ OPTION_INTEGER, 0, "max-depth", &opt.max_depth, N_("depth"),
N_("descend at most <depth> levels"), PARSE_OPT_NONEG,
NULL, 1 },