]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-grep.c
Merge branch 'jk/grep-double-dash'
[git.git] / builtin-grep.c
index 26d4deb1cce3e5540411a47fdf35085649669d06..63d4b95b0d8d1d0f3a3cc8acc50bab9cdf67deaa 100644 (file)
@@ -861,6 +861,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,