diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2008-08-28 20:04:30 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-08-28 22:46:16 -0700 |
commit | 6577f542b3ab64594c7d7a7db752e96be7234fb0 (patch) | |
tree | 2632bcaa41c70b3e1192739c95e6433d35ac9f33 /builtin-grep.c | |
parent | 4f38f6b5bafb1f7f85c7b54d0bb0a0e977cd947c (diff) | |
download | git-6577f542b3ab64594c7d7a7db752e96be7234fb0.tar.gz |
grep: fix worktree setup
Unless used with --cached or grepping on a tree, "git grep" will
search on working directory, so set up worktree properly
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-grep.c')
-rw-r--r-- | builtin-grep.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin-grep.c b/builtin-grep.c index 631129ddfd..3ded1ba9da 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -783,8 +783,11 @@ int cmd_grep(int argc, const char **argv, const char *prefix) paths[1] = NULL; } - if (!list.nr) + if (!list.nr) { + if (!cached) + setup_work_tree(); return !grep_cache(&opt, paths, cached); + } if (cached) die("both --cached and trees are given."); |