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

Re: Bug report

From
JWJohn Whitney <jjw@emsoftware.com>
Date
Oct 9, 2012, 19:00 UTC
Message-ID
<50747443.8080905@emsoftware.com>
In-Reply-To
<50745C32.5050505@emsoftware.com>
On 10/9/12 12:17 PM, John Whitney wrote:
Show 22 quoted lines
> Thank you very much for your detailed explanations. I suspected that 
> efficiency concerns might be preventing a clean solution.
>
> How about this idea... When git stores files, it could include a bit 
> of metadata that tells it whether the file is a binary blob or text. 
> (Perhaps it already does this?) If a binary blob (in the repository) 
> is being compared with a text file (on the filesystem), git could 
> re-process the blob and get the "sha1 of the canonical stripped 
> version". In all other situations, the original SHA1 should be 
> correct, since git already removes CRs from the line endings in files 
> it recognizes as text.
>
> I would think that this solution would have no performance penalty for 
> "fixed" repositories. (It would only have a small performance hit when 
> binary blobs are compared against text files, which is rare even in 
> broken repositories.) Git could even throw a warning like: "File 
> xyz.txt was originally stored as a binary blob."
>
> What do you think?
>
>    ---John
>

I'm going to reply to myself, to save you the trouble of replying. (You've been very helpful and I do appreciate it.)

I guess the problem with this idea is that git doesn't have any way to distinguish between binary blobs and text files in the repository. I think it would be useful information, but I guess that bridge burned a long time ago. So any metadata would have to be stored separately. Jeff, that's roughly equivalent to your idea of caching, which would take a lot of work to implement.

Thank you so much for helping me to understand the reason git behaves the way it does. It's a great tool!

    ---John
Previous: John WhitneyNext: Andrew Wong
Message 8 of 12 in “Bug report”
  1. John WhitneyOct 4, 2012
  2. Phil HordOct 4, 2012
  3. John WhitneyOct 4, 2012
  4. Jeff KingOct 6, 2012
  5. John WhitneyOct 7, 2012
  6. Jeff KingOct 7, 2012
  7. John WhitneyOct 9, 2012
  8. John WhitneyOct 9, 2012
  9. Andrew WongOct 4, 2012
  10. John WhitneyOct 4, 2012
  11. John WhitneyOct 4, 2012
  12. Andrew WongOct 4, 2012

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.