{"thread":{"id":"45267","subject":"log -S/-G (aka pickaxe) searches binary files by default","startedAt":"2017-03-03T01:32:43Z","lastAt":"2017-03-03T18:35:35Z","messageCount":5,"participants":["Thomas Braun","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"313111","messageId":"7a0992eb-adb9-a7a1-cfaa-3384bc4d3e5c@virtuell-zuhause.de","threadId":"45267","inReplyTo":null,"subject":"log -S/-G (aka pickaxe) searches binary files by default","fromName":"Thomas Braun","fromEmail":"thomas.braun@virtuell-zuhause.de","sentAt":"2017-03-03T00:52:52Z","receivedAt":"2017-03-03T01:32:43Z","isPatch":false,"sender":{"key":"thomas.braun@virtuell-zuhause.de","avatar":"https://avatars.githubusercontent.com/u/1185677?v=4"},"body":"Hi,\n\nI happen to have quite large binary files in my repos.\n\nToday I realized that a line like\ngit log -G a\nsearches also files found to be binary (or explicitly marked as binary).\n\nIs that on purpose?\nThe documentation of \"-G<regex>\" states\n\n\"Look for differences whose patch text contains added/removed lines that\nmatch <regex>.\"\n\nwhich contradicts the current behaviour. At least for me text != binary.\n\nTo reproduce:\n$ git init\n$ echo -e \"a\\0b\" > data.bin\n$ git add data.bin\n$ git commit -m \"Add new data\"\n$ git log -p\n[...]\ndiff --git a/data.bin b/data.bin\nnew file mode 100644\nindex 0000000..1a23e4b\nBinary files /dev/null and b/data.bin differ\n$ git log -G a\n[...]\n\n    Add new data\n\nI've verified the behaviour with git version 2.12.0.windows.1 and git\nversion 2.12.0.189.g3bc5322 on debian.\n\nIf it is on purpose is there a config option to disable that?\n\nThanks for reading,\nThomas\n"},{"id":"313125","messageId":"CAPc5daVSY5Z_+cpT1dHY-cM-TzNeu+Vzv+zouoOHW08PTFRQ7A@mail.gmail.com","threadId":"45267","inReplyTo":"7a0992eb-adb9-a7a1-cfaa-3384bc4d3e5c@virtuell-zuhause.de","subject":"Re: log -S/-G (aka pickaxe) searches binary files by default","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-03-03T01:36:17Z","receivedAt":"2017-03-03T02:42:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"On Thu, Mar 2, 2017 at 4:52 PM, Thomas Braun\n<thomas.braun@virtuell-zuhause.de> wrote:\n>\n> I happen to have quite large binary files in my repos.\n>\n> Today I realized that a line like\n> git log -G a\n> searches also files found to be binary (or explicitly marked as binary).\n>\n> Is that on purpose?\n\nNo, it's a mere oversight (as I do not think I never even thought\nabout special casing binary\nfiles from day one, it is unlikely that you would find _any_ old\nversion of Git that behaves\ndifferently).\n"},{"id":"313132","messageId":"20170303051721.r6pahs4vjtqqoevc@sigill.intra.peff.net","threadId":"45267","inReplyTo":"CAPc5daVSY5Z_+cpT1dHY-cM-TzNeu+Vzv+zouoOHW08PTFRQ7A@mail.gmail.com","subject":"Re: log -S/-G (aka pickaxe) searches binary files by default","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-03-03T05:17:21Z","receivedAt":"2017-03-03T05:18:39Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 02, 2017 at 05:36:17PM -0800, Junio C Hamano wrote:\n\n> On Thu, Mar 2, 2017 at 4:52 PM, Thomas Braun\n> <thomas.braun@virtuell-zuhause.de> wrote:\n> >\n> > I happen to have quite large binary files in my repos.\n> >\n> > Today I realized that a line like\n> > git log -G a\n> > searches also files found to be binary (or explicitly marked as binary).\n> >\n> > Is that on purpose?\n> \n> No, it's a mere oversight (as I do not think I never even thought\n> about special casing binary\n> files from day one, it is unlikely that you would find _any_ old\n> version of Git that behaves\n> differently).\n\nThe email focuses on \"-G\", and I think it is wrong to look in binary\nfiles there, as \"grep in diff\" does not make sense for a binary file\nthat we would refuse to diff.\n\nBut the subject also mentions \"-S\". I always assumed it was intentional\nto look in binary files there, as it is searching for a pure byte\nsequence. I would not mind an option to disable that, but I think the\ndefault should remain on.\n\n-Peff\n"},{"id":"313191","messageId":"xmqqzih29wdu.fsf@gitster.mtv.corp.google.com","threadId":"45267","inReplyTo":"20170303051721.r6pahs4vjtqqoevc@sigill.intra.peff.net","subject":"Re: log -S/-G (aka pickaxe) searches binary files by default","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-03-03T16:07:41Z","receivedAt":"2017-03-03T16:11:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Thu, Mar 02, 2017 at 05:36:17PM -0800, Junio C Hamano wrote:\n> ...\n>> > Is that on purpose?\n>> \n>> No, it's a mere oversight (as I do not think I never even thought\n>> about special casing binary\n>> files from day one, it is unlikely that you would find _any_ old\n>> version of Git that behaves\n>> differently).\n>\n> The email focuses on \"-G\", and I think it is wrong to look in binary\n> files there, as \"grep in diff\" does not make sense for a binary file\n> that we would refuse to diff.\n\nYeah, I agree.\n\n> But the subject also mentions \"-S\". I always assumed it was intentional\n> to look in binary files there, as it is searching for a pure byte\n> sequence. I would not mind an option to disable that, but I think the\n> default should remain on.\n\nAs the feature was built to be one of the core ingredients necessary\ntowards the 'ideal SCM' envisioned in\n\n  <http://public-inbox.org/git/Pine.LNX.4.58.0504150753440.7211@ppc970.osdl.org>\n\n\"-S\" is about finding \"a block of text\". It was merely an oversight\nthat we didn't add explicit code to ignore binary when we introduced\nthe concept of \"is this text?  is it worth finding things in and\ndiffing binary files?\".\n\nI do agree that it may be too late and/or disruptive to change its\nbehaviour now, as people may grew expectations different from the\noriginal motivation and design, though.\n\n"},{"id":"313215","messageId":"dcce9a68-a54d-b798-e301-bc92b7fd2cd7@virtuell-zuhause.de","threadId":"45267","inReplyTo":"xmqqzih29wdu.fsf@gitster.mtv.corp.google.com","subject":"Re: log -S/-G (aka pickaxe) searches binary files by default","fromName":"Thomas Braun","fromEmail":"thomas.braun@virtuell-zuhause.de","sentAt":"2017-03-03T18:05:07Z","receivedAt":"2017-03-03T18:35:35Z","isPatch":false,"sender":{"key":"thomas.braun@virtuell-zuhause.de","avatar":"https://avatars.githubusercontent.com/u/1185677?v=4"},"body":"Am 03.03.2017 um 17:07 schrieb Junio C Hamano:\n> Jeff King <peff@peff.net> writes:\n> \n>> On Thu, Mar 02, 2017 at 05:36:17PM -0800, Junio C Hamano wrote:\n>> ...\n>>>> Is that on purpose?\n>>>\n>>> No, it's a mere oversight (as I do not think I never even thought\n>>> about special casing binary\n>>> files from day one, it is unlikely that you would find _any_ old\n>>> version of Git that behaves\n>>> differently).\n>>\n>> The email focuses on \"-G\", and I think it is wrong to look in binary\n>> files there, as \"grep in diff\" does not make sense for a binary file\n>> that we would refuse to diff.\n> \n> Yeah, I agree.\n> \n>> But the subject also mentions \"-S\". I always assumed it was intentional\n>> to look in binary files there, as it is searching for a pure byte\n>> sequence. I would not mind an option to disable that, but I think the\n>> default should remain on.\n> \n> As the feature was built to be one of the core ingredients necessary\n> towards the 'ideal SCM' envisioned in\n> \n>   <http://public-inbox.org/git/Pine.LNX.4.58.0504150753440.7211@ppc970.osdl.org>\n> \n> \"-S\" is about finding \"a block of text\". It was merely an oversight\n> that we didn't add explicit code to ignore binary when we introduced\n> the concept of \"is this text?  is it worth finding things in and\n> diffing binary files?\".\n> \n> I do agree that it may be too late and/or disruptive to change its\n> behaviour now, as people may grew expectations different from the\n> original motivation and design, though.\n\nThanks both for the encouraging answers.\n\nI'll try to come up with patches in the next couple of weeks for the\nfollowing changes:\n\"log -G\": disable looking in binaries\n\"log -S\": add option to switch looking into binaries, defaults to true\n\nThomas\n\n"}]}