X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin%2Fgrep.c;h=da32f3df34da7af3cdcb0a9dd6aa66061bdfe927;hb=f9c8e7c8f134597f34315cb1b5fcd4598c3453ca;hp=b725ede0f7270637759b9fef52ab5450fc1712e2;hpb=a621859101370205d89a6fea7ba17839a43eb4ab;p=git.git diff --git a/builtin/grep.c b/builtin/grep.c index b725ede0f..da32f3df3 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -839,7 +839,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) struct string_list path_list = STRING_LIST_INIT_NODUP; int i; int dummy; - int nongit = 0, use_index = 1; + int use_index = 1; struct option options[] = { OPT_BOOLEAN(0, "cached", &cached, "search in index instead of in the work tree"), @@ -930,8 +930,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix) OPT_END() }; - prefix = setup_git_directory_gently(&nongit); - /* * 'git grep -h', unlike 'git grep -h ', is a request * to show usage information and exit. @@ -976,7 +974,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) PARSE_OPT_STOP_AT_NON_OPTION | PARSE_OPT_NO_INTERNAL_HELP); - if (use_index && nongit) + if (use_index && !startup_info->have_repository) /* die the same way as if we did it at the beginning */ setup_git_directory();