Code

grep docs: document --no-index option
[git.git] / builtin-grep.c
index 362122c4325a0419a038fda52768d78d3e12dc31..26979577d3f753cdc8b3358954249708d4cb53ef 100644 (file)
@@ -868,6 +868,16 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                             PARSE_OPT_STOP_AT_NON_OPTION |
                             PARSE_OPT_NO_INTERNAL_HELP);
 
+       /*
+        * skip a -- separator; we know it cannot be
+        * separating revisions from pathnames if
+        * we haven't even had any patterns yet
+        */
+       if (argc > 0 && !opt.pattern_list && !strcmp(argv[0], "--")) {
+               argv++;
+               argc--;
+       }
+
        /* First unrecognized non-option token */
        if (argc > 0 && !opt.pattern_list) {
                append_grep_pattern(&opt, argv[0], "command line", 0,