Code

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 2e7986cecefc964f665b10d363569951c1f40293..a8bec72f82a9cac96b2b46bddb255b8be15cd6d1 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);