{"thread":{"id":"17507","subject":"git grep -I bug","startedAt":"2009-02-02T17:42:57Z","lastAt":"2009-02-03T19:42:58Z","messageCount":5,"participants":["Jeremy O'Brien","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"102872","messageId":"20090202174257.GA8259@Ambelina.erc-wireless.uc.edu","threadId":"17507","inReplyTo":null,"subject":"git grep -I bug","fromName":"Jeremy O'Brien","fromEmail":"obrien654j@gmail.com","sentAt":"2009-02-02T17:42:57Z","receivedAt":"2009-02-02T17:42:57Z","isPatch":false,"sender":{"key":"obrien654j@gmail.com","avatar":"https://gravatar.com/avatar/5c9159e1ccac9be7207778ee0115f17ba6193550017cad0d2454d2da04089a15?d=mp&s=160"},"body":"I am running git version 1.6.1.2.309.g2ea3.\n\nWhen I use\n\ngit grep -I \"string_to_match\"\n\nto ignore binary files in my grep, binary files are returned anyway.\n\nWhen I do a regular\n\ngrep \"string_to_match\" *\n\ngrep does not show the binary files. I believe this is a bug.\n\nThanks,\nJeremy O'Brien\n"},{"id":"102874","messageId":"7vwsc8hgh4.fsf@gitster.siamese.dyndns.org","threadId":"17507","inReplyTo":"20090202174257.GA8259@Ambelina.erc-wireless.uc.edu","subject":"Re: git grep -I bug","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-02T17:54:31Z","receivedAt":"2009-02-02T17:54:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeremy O'Brien <obrien654j@gmail.com> writes:\n\n> I am running git version 1.6.1.2.309.g2ea3.\n>\n> When I use\n>\n> git grep -I \"string_to_match\"\n>\n> to ignore binary files in my grep, binary files are returned anyway.\n\nOne sanity check.  What does 'git grep --cached -I \"string_to_match\"' do\nin that case?\n\nIf it works as expected but without --cached it doesn't, then I think the\nfollowing patch will fix it.\n\n-- >8 --\nSubject: grep: pass -I (ignore binary) down to external grep\n\nThe external-grep codepath forgets to pass this option.  Fix it.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin-grep.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git c/builtin-grep.c w/builtin-grep.c\nindex bebf15c..c799fdd 100644\n--- c/builtin-grep.c\n+++ w/builtin-grep.c\n@@ -297,6 +297,8 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)\n \t\tpush_arg(\"-l\");\n \tif (opt->unmatch_name_only)\n \t\tpush_arg(\"-L\");\n+\tif (opt->binary == GREP_BINARY_NOMATCH)\n+\t\tpush_arg(\"-I\");\n \tif (opt->null_following_name)\n \t\t/* in GNU grep git's \"-z\" translates to \"-Z\" */\n \t\tpush_arg(\"-Z\");\n"},{"id":"102876","messageId":"20090202182601.GA173@Ambelina.local","threadId":"17507","inReplyTo":"7vwsc8hgh4.fsf@gitster.siamese.dyndns.org","subject":"Re: git grep -I bug","fromName":"Jeremy O'Brien","fromEmail":"obrien654j@gmail.com","sentAt":"2009-02-02T18:26:01Z","receivedAt":"2009-02-02T18:26:01Z","isPatch":false,"sender":{"key":"obrien654j@gmail.com","avatar":"https://gravatar.com/avatar/5c9159e1ccac9be7207778ee0115f17ba6193550017cad0d2454d2da04089a15?d=mp&s=160"},"body":"On Mon, Feb 02, 2009 at 09:54:31AM -0800, Junio C Hamano wrote:\n> Jeremy O'Brien <obrien654j@gmail.com> writes:\n> \n> > I am running git version 1.6.1.2.309.g2ea3.\n> >\n> > When I use\n> >\n> > git grep -I \"string_to_match\"\n> >\n> > to ignore binary files in my grep, binary files are returned anyway.\n> \n> One sanity check.  What does 'git grep --cached -I \"string_to_match\"' do\n> in that case?\n> \n\nIt works as expected. It is interesting that while my Linux install was\naffected by this bug, my Mac OS X install did not seem to be affected by\nit, while running the same version of git.\n"},{"id":"102916","messageId":"7v1vugf8gc.fsf@gitster.siamese.dyndns.org","threadId":"17507","inReplyTo":"20090202182601.GA173@Ambelina.local","subject":"Re: git grep -I bug","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-03T04:30:43Z","receivedAt":"2009-02-03T04:30:43Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeremy O'Brien <obrien654j@gmail.com> writes:\n\n> On Mon, Feb 02, 2009 at 09:54:31AM -0800, Junio C Hamano wrote:\n>> Jeremy O'Brien <obrien654j@gmail.com> writes:\n>> \n>> > I am running git version 1.6.1.2.309.g2ea3.\n>> >\n>> > When I use\n>> >\n>> > git grep -I \"string_to_match\"\n>> >\n>> > to ignore binary files in my grep, binary files are returned anyway.\n>> \n>> One sanity check.  What does 'git grep --cached -I \"string_to_match\"' do\n>> in that case?\n>> \n>\n> It works as expected. It is interesting that while my Linux install was\n> affected by this bug, my Mac OS X install did not seem to be affected by\n> it, while running the same version of git.\n\nPerhaps your Mac OSX binary was built without external grep support.\n\nDid the patch fix the issue, by the way?\n"},{"id":"103018","messageId":"20090203194258.GA1354@Ambelina.snd-wireless.uc.edu","threadId":"17507","inReplyTo":"7v1vugf8gc.fsf@gitster.siamese.dyndns.org","subject":"Re: git grep -I bug","fromName":"Jeremy O'Brien","fromEmail":"obrien654j@gmail.com","sentAt":"2009-02-03T19:42:58Z","receivedAt":"2009-02-03T19:42:58Z","isPatch":false,"sender":{"key":"obrien654j@gmail.com","avatar":"https://gravatar.com/avatar/5c9159e1ccac9be7207778ee0115f17ba6193550017cad0d2454d2da04089a15?d=mp&s=160"},"body":"On Mon, Feb 02, 2009 at 08:30:43PM -0800, Junio C Hamano wrote:\n> Jeremy O'Brien <obrien654j@gmail.com> writes:\n> \n> > On Mon, Feb 02, 2009 at 09:54:31AM -0800, Junio C Hamano wrote:\n> >> Jeremy O'Brien <obrien654j@gmail.com> writes:\n> >> \n> >> > I am running git version 1.6.1.2.309.g2ea3.\n> >> >\n> >> > When I use\n> >> >\n> >> > git grep -I \"string_to_match\"\n> >> >\n> >> > to ignore binary files in my grep, binary files are returned anyway.\n> >> \n> >> One sanity check.  What does 'git grep --cached -I \"string_to_match\"' do\n> >> in that case?\n> >> \n> >\n> > It works as expected. It is interesting that while my Linux install was\n> > affected by this bug, my Mac OS X install did not seem to be affected by\n> > it, while running the same version of git.\n> \n> Perhaps your Mac OSX binary was built without external grep support.\n> \n> Did the patch fix the issue, by the way?\n\nI'm assuming that was the problem. And yes, the patch fixed it just\nfine, thank you.\n"}]}