summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e0eb889)
raw | patch | inline | side by side (parent: e0eb889)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 1 May 2006 19:39:21 +0000 (12:39 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 1 May 2006 19:40:17 +0000 (12:40 -0700) |
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-grep.c | patch | blob | history |
diff --git a/builtin-grep.c b/builtin-grep.c
index 653b65ea1040a6d4e41f0c32df6c6766e04bc8d0..c3e6701aa0d29e13421fb47bdcb7bdfcad7d5438 100644 (file)
--- a/builtin-grep.c
+++ b/builtin-grep.c
regex_t regexp;
unsigned linenum:1;
unsigned invert:1;
+ unsigned name_only:1;
int regflags;
unsigned pre_context;
unsigned post_context;
if (opt->invert)
hit = !hit;
if (hit) {
+ if (opt->name_only) {
+ printf("%s\n", name);
+ return 1;
+ }
/* Hit at this line. If we haven't shown the
* pre-context lines, we would need to show them.
*/
*/
continue;
}
+ if (!strcmp("-l", arg) ||
+ !strcmp("--files-with-matches", arg)) {
+ opt.name_only = 1;
+ continue;
+ }
if (!strcmp("-A", arg) ||
!strcmp("-B", arg) ||
!strcmp("-C", arg)) {