diff --git a/builtin/grep.c b/builtin/grep.c
index 597f76bc42f51e0fc1906c287981e3d37dc0f536..ca56c5b0099e19059b51440880d032c5e1d27f5e 100644 (file)
--- a/builtin/grep.c
+++ b/builtin/grep.c
struct string_list path_list = { NULL, 0, 0, 0 };
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"),
OPT_END()
};
- prefix = setup_git_directory_gently(&nongit);
-
/*
* 'git grep -h', unlike 'git grep -h <pattern>', is a request
* to show usage information and exit.
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();