summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-10-19 13:34:05 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-10-19 13:34:06 +0900
commit9822b8f10d2c255c3bda81aa800fa056549f034a (patch)
tree85959ab31de49c7360745b67f14694a9a97ed2fd /builtin
parentMerge branch 'nd/help-commands-verbose-by-default' (diff)
parentgrep: add -r/--[no-]recursive (diff)
downloadtgif-9822b8f10d2c255c3bda81aa800fa056549f034a.tar.xz
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')
-rw-r--r--builtin/grep.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index 0c3527242e..d8508ddf79 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 },