git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: log -S/-G (aka pickaxe) searches binary files by default

From
Thomas Braun <thomas.braun@virtuell-zuhause.de>
Date
Mar 3, 2017, 18:05 UTC
Message-ID
<dcce9a68-a54d-b798-e301-bc92b7fd2cd7@virtuell-zuhause.de>
In-Reply-To
<xmqqzih29wdu.fsf@gitster.mtv.corp.google.com>
Am 03.03.2017 um 17:07 schrieb Junio C Hamano:
Show 36 quoted lines
> Jeff King <peff@peff.net> writes:
> 
>> On Thu, Mar 02, 2017 at 05:36:17PM -0800, Junio C Hamano wrote:
>> ...
>>>> Is that on purpose?
>>>
>>> No, it's a mere oversight (as I do not think I never even thought
>>> about special casing binary
>>> files from day one, it is unlikely that you would find _any_ old
>>> version of Git that behaves
>>> differently).
>>
>> The email focuses on "-G", and I think it is wrong to look in binary
>> files there, as "grep in diff" does not make sense for a binary file
>> that we would refuse to diff.
> 
> Yeah, I agree.
> 
>> But the subject also mentions "-S". I always assumed it was intentional
>> to look in binary files there, as it is searching for a pure byte
>> sequence. I would not mind an option to disable that, but I think the
>> default should remain on.
> 
> As the feature was built to be one of the core ingredients necessary
> towards the 'ideal SCM' envisioned in
> 
>   <http://public-inbox.org/git/Pine.LNX.4.58.0504150753440.7211@ppc970.osdl.org>
> 
> "-S" is about finding "a block of text". It was merely an oversight
> that we didn't add explicit code to ignore binary when we introduced
> the concept of "is this text?  is it worth finding things in and
> diffing binary files?".
> 
> I do agree that it may be too late and/or disruptive to change its
> behaviour now, as people may grew expectations different from the
> original motivation and design, though.
Thanks both for the encouraging answers.

I'll try to come up with patches in the next couple of weeks for the following changes: "log -G": disable looking in binaries "log -S": add option to switch looking into binaries, defaults to true

Thomas
Previous: Junio C Hamano
Message 5 of 5 in “log -S/-G (aka pickaxe) searches binary files by default”
  1. Thomas BraunMar 3, 2017
  2. Junio C HamanoMar 3, 2017
  3. Jeff KingMar 3, 2017
  4. Junio C HamanoMar 3, 2017
  5. Thomas BraunMar 3, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.