[PATCH/RFC 2/2] grep: make --full-tree work with pathspecs
- From
Michael J Gruber <git@drmicha.warpmail.net>
- Date
- Mar 1, 2011, 09:53 UTC
- Message-ID
- <3719d9a120eef618d875629662a87e715de55d4e.1298972832.git.git@drmicha.warpmail.net>
- In-Reply-To
- <AANLkTi=xrnxUtkayyW1Merh49N6uHy5p-GMrYe6+p==t@mail.gmail.com>
When --full-tree is given, make the pathspecs be applied relative to the root. That way, "git grep --full-tree expr -- *.c" looks in all C files in the repo.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> --- builtin/grep.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin/grep.c b/builtin/grep.c index d005528..e0a75a7 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -959,7 +959,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) } if (i < argc) - paths = get_pathspec(prefix, argv + i); + paths = get_pathspec(!full_tree ? prefix : NULL, argv + i); else if (prefix && !full_tree) { paths = xcalloc(2, sizeof(const char *)); paths[0] = prefix;
-- 1.7.4.1.257.gb09fa