diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2010-05-22 23:30:48 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-05-24 11:22:06 -0700 |
commit | 321ffcc0556a94c461ac84667b35494c193804ec (patch) | |
tree | 778d9cb2c32331cadec7200349c52b440d5947a7 /grep.c | |
parent | c30c10cff1d640ce119596b907c10cc11f83358d (diff) | |
download | git-321ffcc0556a94c461ac84667b35494c193804ec.tar.gz |
grep: --name-only over binary
As with the option -c/--count, git grep with the option -l/--name-only
should work the same with binary files as with text files because
there is no danger of messing up the terminal with control characters
from the contents of matching files. GNU grep does the same.
Move the check for ->name_only before the one for binary_match_only,
thus making the latter irrelevant for git grep -l.
Reported-by: Dmitry Potapov <dpotapov@gmail.com>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.c')
-rw-r--r-- | grep.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -873,6 +873,10 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name, count++; if (opt->status_only) return 1; + if (opt->name_only) { + show_name(opt, name); + return 1; + } if (opt->count) goto next_line; if (binary_match_only) { @@ -882,10 +886,6 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name, opt->output(opt, " matches\n", 9); return 1; } - if (opt->name_only) { - show_name(opt, name); - return 1; - } /* Hit at this line. If we haven't shown the * pre-context lines, we would need to show them. */ |