git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-grep: allow patterns starting with -
@ 2006-06-25 15:38 Matthias Lederhofer
  2006-06-25 15:47 ` Timo Hirvonen
  0 siblings, 1 reply; 32+ messages in thread
From: Matthias Lederhofer @ 2006-06-25 15:38 UTC (permalink / raw)
  To: git

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
I did not find another way to use patterns starting with -, if it is
possible without the patch please tell me and ignore the patch :)
example:
% git grep -- --bla HEAD HEAD~1 -- --foo
HEAD:--foo/bla:test --bla foo

 builtin-grep.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/builtin-grep.c b/builtin-grep.c
index 2e7986c..d0677cc 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -817,8 +817,13 @@ int cmd_grep(int argc, const char **argv
 			}
 			usage(builtin_grep_usage);
 		}
-		if (!strcmp("--", arg))
+		if (!strcmp("--", arg)) {
+			if (!opt.pattern_list && argc > 0) {
+				argc--; argv++;
+				add_pattern(&opt, *argv, "command line", 0);
+			}
 			break;
+		}
 		if (*arg == '-')
 			usage(builtin_grep_usage);
 
-- 
1.4.1.rc1.g29f4a-dirty

^ permalink raw reply related	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2006-07-03  7:54 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-25 15:38 [PATCH] git-grep: allow patterns starting with - Matthias Lederhofer
2006-06-25 15:47 ` Timo Hirvonen
2006-06-25 16:07   ` [PATCH] correct documentation for git grep Matthias Lederhofer
2006-06-25 23:10     ` Johannes Schindelin
2006-06-25 23:39       ` Matthias Lederhofer
2006-06-26  0:06         ` Matthias Lederhofer
2006-06-26  6:59           ` Johannes Schindelin
2006-06-26  0:02       ` [PATCH] git-grep: --and to combine patterns with and instead of or Matthias Lederhofer
2006-06-29 22:20         ` Thomas Glanzmann
2006-06-29 22:44           ` Junio C Hamano
2006-06-30  2:25             ` Matthias Lederhofer
2006-06-30  4:13               ` Junio C Hamano
2006-06-30  7:46                 ` Matthias Lederhofer
2006-06-30  7:56                   ` Junio C Hamano
2006-06-30 10:08                     ` [PATCH] git-grep: boolean expression on pattern matching Junio C Hamano
2006-06-30 10:24                       ` Jakub Narebski
2006-06-30 10:29                         ` Junio C Hamano
2006-06-30 15:11                       ` Matthias Lederhofer
2006-06-30 10:57                     ` [PATCH] git-grep: --and to combine patterns with and instead of or Matthias Lederhofer
2006-06-30 15:57                       ` Junio C Hamano
2006-06-30 17:04                         ` Matthias Lederhofer
2006-06-30 17:18                           ` Junio C Hamano
2006-06-30 17:33                             ` Jakub Narebski
2006-06-30 17:49                               ` Matthias Lederhofer
2006-06-30 17:58                                 ` Junio C Hamano
2006-06-30 18:20                                   ` Matthias Lederhofer
2006-06-30 18:03                                 ` Jakub Narebski
2006-06-30 18:16                                   ` Junio C Hamano
2006-06-30 19:11                                     ` Jakub Narebski
2006-06-30 20:26                                       ` Junio C Hamano
2006-07-03  7:54                         ` Andreas Ericsson
2006-06-25 16:18   ` [PATCH] git-grep: allow patterns starting with - Matthias Lederhofer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).