OSDN Git Service

git-grep: fix parsing of pathspec separator '--'
authorJunio C Hamano <junkio@cox.net>
Tue, 4 Jul 2006 09:31:50 +0000 (02:31 -0700)
committerJunio C Hamano <junkio@cox.net>
Tue, 4 Jul 2006 10:15:46 +0000 (03:15 -0700)
We used to misparse

git grep -e foo -- '*.sh'

Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-grep.c

index 2e7986c..a8bec72 100644 (file)
@@ -817,8 +817,12 @@ int cmd_grep(int argc, const char **argv, char **envp)
                        }
                        usage(builtin_grep_usage);
                }
-               if (!strcmp("--", arg))
+               if (!strcmp("--", arg)) {
+                       /* later processing wants to have this at argv[1] */
+                       argv--;
+                       argc++;
                        break;
+               }
                if (*arg == '-')
                        usage(builtin_grep_usage);