aboutsummaryrefslogtreecommitdiff
path: root/builtin-grep.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-09-03 15:35:37 -0700
committerJunio C Hamano <gitster@pobox.com>2008-09-03 15:35:37 -0700
commit6a42cfe86c485675987b64690e75d8821567d328 (patch)
treebe6e1a64fa65abe7f0013e0256a9439f6e73e0ac /builtin-grep.c
parent36f44a06802960abce7febbf9cc40461e5546ee5 (diff)
parentbb528633b34ac9c338a7761f3e1d251e0c560ed6 (diff)
downloadgit-6a42cfe86c485675987b64690e75d8821567d328.tar.gz
git-6a42cfe86c485675987b64690e75d8821567d328.tar.xz
Merge branch 'nd/worktree' into maint
* nd/worktree: setup_git_directory(): fix move to worktree toplevel directory update-index: fix worktree setup read-tree: setup worktree if merge is required grep: fix worktree setup diff*: fix worktree setup
Diffstat (limited to 'builtin-grep.c')
-rw-r--r--builtin-grep.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin-grep.c b/builtin-grep.c
index f59f95f17..3a51662a3 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.");