diff options
author | Brandon Williams <bmwill@google.com> | 2016-12-16 11:03:20 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-22 11:47:33 -0800 |
commit | 0281e487fd913bd9a32a710f3109ff3002f3e4a9 (patch) | |
tree | 3b5b3bda83044726df670a446bbf6764d2cde6da /Documentation/git-grep.txt | |
parent | grep: add submodules as a grep source type (diff) | |
download | tgif-0281e487fd913bd9a32a710f3109ff3002f3e4a9.tar.xz |
grep: optionally recurse into submodules
Allow grep to recognize submodules and recursively search for patterns in
each submodule. This is done by forking off a process to recursively
call grep on each submodule. The top level --super-prefix option is
used to pass a path to the submodule which can in turn be used to
prepend to output or in pathspec matching logic.
Recursion only occurs for submodules which have been initialized and
checked out by the parent project. If a submodule hasn't been
initialized and checked out it is simply skipped.
In order to support the existing multi-threading infrastructure in grep,
output from each child process is captured in a strbuf so that it can be
later printed to the console in an ordered fashion.
To limit the number of theads that are created, each child process has
half the number of threads as its parents (minimum of 1), otherwise we
potentailly have a fork-bomb.
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-grep.txt')
-rw-r--r-- | Documentation/git-grep.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt index 0ecea6e491..17aa1ba702 100644 --- a/Documentation/git-grep.txt +++ b/Documentation/git-grep.txt @@ -26,6 +26,7 @@ SYNOPSIS [--threads <num>] [-f <file>] [-e] <pattern> [--and|--or|--not|(|)|-e <pattern>...] + [--recurse-submodules] [ [--[no-]exclude-standard] [--cached | --no-index | --untracked] | <tree>...] [--] [<pathspec>...] @@ -88,6 +89,10 @@ OPTIONS mechanism. Only useful when searching files in the current directory with `--no-index`. +--recurse-submodules:: + Recursively search in each submodule that has been initialized and + checked out in the repository. + -a:: --text:: Process binary files as if they were text. |