grep: do not use --index in the short usage output
[gitweb.git] / builtin-grep.c
index 9bd467c9b90d1c58a59e27fbc6673cb68d855c72..e3eeb77cc789796d659cbd9eb28af189bdcf4ee4 100644 (file)
@@ -205,6 +205,8 @@ static void *run(void *arg)
 
                work_done(w);
        }
+       free_grep_patterns(arg);
+       free(arg);
 
        return (void*) (intptr_t) hit;
 }
@@ -760,8 +762,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
        struct option options[] = {
                OPT_BOOLEAN(0, "cached", &cached,
                        "search in index instead of in the work tree"),
-               OPT_BOOLEAN(0, "index", &use_index,
-                       "--no-index finds in contents not managed by git"),
+               { OPTION_BOOLEAN, 0, "index", &use_index, NULL,
+                       "finds in contents not managed by git",
+                       PARSE_OPT_NOARG | PARSE_OPT_NEGHELP },
                OPT_GROUP(""),
                OPT_BOOLEAN('v', "invert-match", &opt.invert,
                        "show non-matching lines"),