path: root/grep.h
diff options
authorMichał Kiedrowicz <>2009-07-22 17:52:15 (GMT)
committerJunio C Hamano <>2009-07-23 04:54:54 (GMT)
commita91f453f641ca9966a438bdd3896656b00423407 (patch)
tree8ba410fe118f0e5776ac9dd8631d5ceeeba0cd3e /grep.h
parent2a679c7a3148978a3f58f1c12100383638e744c5 (diff)
grep: Add --max-depth option.
It is useful to grep directories non-recursively, e.g. when one wants to look for all files in the toplevel directory, but not in any subdirectory, or in Documentation/, but not in Documentation/technical/. This patch adds support for --max-depth <depth> option to git-grep. If it is given, git-grep descends at most <depth> levels of directories below paths specified on the command line. Note that if path specified on command line contains wildcards, this option makes no sense, e.g. $ git grep -l --max-depth 0 GNU -- 'contrib/*' (note the quotes) will search all files in contrib/, even in subdirectories, because '*' matches all files. Documentation updates, bash-completion and simple test cases are also provided. Signed-off-by: Michał Kiedrowicz <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'grep.h')
1 files changed, 1 insertions, 0 deletions
diff --git a/grep.h b/grep.h
index f00db0e..28e6b2a 100644
--- a/grep.h
+++ b/grep.h
@@ -79,6 +79,7 @@ struct grep_opt {
int pathname;
int null_following_name;
int color;
+ int max_depth;
int funcname;
char color_match[COLOR_MAXLEN];
const char *color_external;