X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin-grep.c;h=3ded1ba9da9166c09fb1b65d315499e24036466d;hb=6577f542b3ab64594c7d7a7db752e96be7234fb0;hp=631129ddfd0ffe06f919882d22cfc494d9553f50;hpb=d9d9e6ee6366fed93a4beff3994bad376f81eabd;p=git.git diff --git a/builtin-grep.c b/builtin-grep.c index 631129ddf..3ded1ba9d 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.");