diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-02-17 14:55:15 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-02-17 14:55:15 -0800 |
commit | 031f82f75124dc96e3bebf8fa0b15eddf5544012 (patch) | |
tree | 294a13008dd8a12588453825ed2266be645b1ddd /builtin-grep.c | |
parent | 07cb9a369e12633e1e43e0acded32885592a455c (diff) | |
parent | 1123c67ceee2f310b08ab5d67b076ef04ab59bfc (diff) | |
download | git-031f82f75124dc96e3bebf8fa0b15eddf5544012.tar.gz |
Merge branch 'jk/grep-double-dash' into maint
* jk/grep-double-dash:
accept "git grep -- pattern"
Diffstat (limited to 'builtin-grep.c')
-rw-r--r-- | builtin-grep.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin-grep.c b/builtin-grep.c index 362122c432..26979577d3 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -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, |