diff options
author | Brandon Williams <bmwill@google.com> | 2016-12-16 11:03:21 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-22 11:47:33 -0800 |
commit | 74ed43711fd1cd7ce155d338f87ebe52cb74d9e2 (patch) | |
tree | 3abc50be55697613432ff802730784d8fee088fd /Documentation | |
parent | 0281e487fd913bd9a32a710f3109ff3002f3e4a9 (diff) | |
download | git-74ed43711fd1cd7ce155d338f87ebe52cb74d9e2.tar.gz git-74ed43711fd1cd7ce155d338f87ebe52cb74d9e2.tar.xz |
grep: enable recurse-submodules to work on <tree> objects
Teach grep to recursively search in submodules when provided with a
<tree> object. This allows grep to search a submodule based on the state
of the submodule that is present in a commit of the super project.
When grep is provided with a <tree> object, the name of the object is
prefixed to all output. In order to provide uniformity of output
between the parent and child processes the option `--parent-basename`
has been added so that the child can preface all of it's output with the
name of the parent's object instead of the name of the commit SHA1 of
the submodule. This changes output from the command
`git grep -e. -l --recurse-submodules HEAD` from:
HEAD:file
<commit sha1 of submodule>:sub/file
to:
HEAD:file
HEAD:sub/file
Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/git-grep.txt | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt index 17aa1ba70..71f32f350 100644 --- a/Documentation/git-grep.txt +++ b/Documentation/git-grep.txt @@ -26,7 +26,7 @@ SYNOPSIS [--threads <num>] [-f <file>] [-e] <pattern> [--and|--or|--not|(|)|-e <pattern>...] - [--recurse-submodules] + [--recurse-submodules] [--parent-basename <basename>] [ [--[no-]exclude-standard] [--cached | --no-index | --untracked] | <tree>...] [--] [<pathspec>...] @@ -91,7 +91,16 @@ OPTIONS --recurse-submodules:: Recursively search in each submodule that has been initialized and - checked out in the repository. + checked out in the repository. When used in combination with the + <tree> option the prefix of all submodule output will be the name of + the parent project's <tree> object. + +--parent-basename <basename>:: + For internal use only. In order to produce uniform output with the + --recurse-submodules option, this option can be used to provide the + basename of a parent's <tree> object to a submodule so the submodule + can prefix its output with the parent's name rather than the SHA1 of + the submodule. -a:: --text:: |