From: Junio C Hamano <gitster@pobox.com>
To: Jeremy O'Brien <obrien654j@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git grep -I bug
Date: Mon, 02 Feb 2009 09:54:31 -0800 [thread overview]
Message-ID: <7vwsc8hgh4.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20090202174257.GA8259@Ambelina.erc-wireless.uc.edu> (Jeremy O'Brien's message of "Mon, 2 Feb 2009 12:42:57 -0500")
Jeremy O'Brien <obrien654j@gmail.com> writes:
> I am running git version 1.6.1.2.309.g2ea3.
>
> When I use
>
> git grep -I "string_to_match"
>
> to ignore binary files in my grep, binary files are returned anyway.
One sanity check. What does 'git grep --cached -I "string_to_match"' do
in that case?
If it works as expected but without --cached it doesn't, then I think the
following patch will fix it.
-- >8 --
Subject: grep: pass -I (ignore binary) down to external grep
The external-grep codepath forgets to pass this option. Fix it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-grep.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git c/builtin-grep.c w/builtin-grep.c
index bebf15c..c799fdd 100644
--- c/builtin-grep.c
+++ w/builtin-grep.c
@@ -297,6 +297,8 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
push_arg("-l");
if (opt->unmatch_name_only)
push_arg("-L");
+ if (opt->binary == GREP_BINARY_NOMATCH)
+ push_arg("-I");
if (opt->null_following_name)
/* in GNU grep git's "-z" translates to "-Z" */
push_arg("-Z");
next prev parent reply other threads:[~2009-02-02 17:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-02 17:42 git grep -I bug Jeremy O'Brien
2009-02-02 17:54 ` Junio C Hamano [this message]
2009-02-02 18:26 ` Jeremy O'Brien
2009-02-03 4:30 ` Junio C Hamano
2009-02-03 19:42 ` Jeremy O'Brien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vwsc8hgh4.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=obrien654j@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.