X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin-grep.c;h=3a51662a35878ae6b5965c90abb747b5b27c5493;hb=27551baa3eddc4111ceee13dc05850ae80c99a3e;hp=631129ddfd0ffe06f919882d22cfc494d9553f50;hpb=847d10f56d7853cd0e139a7c2e6ad0ad2de5c464;p=git.git diff --git a/builtin-grep.c b/builtin-grep.c index 631129ddf..3a51662a3 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -774,7 +774,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) /* Make sure we do not get outside of paths */ for (i = 0; paths[i]; i++) if (strncmp(prefix, paths[i], opt.prefix_length)) - die("git-grep: cannot generate relative filenames containing '..'"); + die("git grep: cannot generate relative filenames containing '..'"); } } else if (prefix) { @@ -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.");