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

Re: [PATCHv2] write_index: optionally allow broken null sha1s

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 26, 2013, 06:03 UTC
Message-ID
<xmqqob8lj8dx.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20130825195412.GA2752@elie.Belkin>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 17 quoted lines
> In other words, why not use something like this?
>
> 	write_index: optionally allow broken null sha1s
>
> 	Commit 4337b58 (do not write null sha1s to on-disk index, 2012-07-28)
> 	added a safety check preventing git from writing null sha1s into the
> 	index. The intent was to catch errors in other parts of the code that
> 	might let such an entry slip into the index (or worse, a tree).
>
> 	Some existing repositories have some invalid trees that contain null
> 	sha1s already, though.  Until 4337b58, a common way to clean this up
> 	would be to use git-filter-branch's index-filter to repair such broken
> 	entries.  That now fails when filter-branch tries to write out the
> 	index.
>
> 	Introduce a GIT_ALLOW_NULL_SHA1 environment variable to relax this check
> 	and make it easier to recover from such a history.
I found this version more readable than Peff's (albeit slightly).
> After this patch, do you think (in a separate change) it would make
> sense for cache-tree.c::update_one() to check for null sha1 and error
> out unless GIT_ALLOW_NULL_SHA1 is true?  That would let us get rid of
> the caveat from the last paragraph.
Hmm, interesting thought.
Previous: Jonathan NiederNext: Jeff King
Message 5 of 13 in “write_index: optionally allow broken null sha1s”
  1. write_index: optionally allow broken null sha1sJeff King, Aug 24, 2013
  2. Jonathan NiederAug 25, 2013
  3. [PATCHv2] write_index: optionally allow broken null sha1sJeff King, Aug 25, 2013
  4. Jonathan NiederAug 25, 2013
  5. Junio C HamanoAug 26, 2013
  6. Jeff KingAug 26, 2013
  7. Junio C HamanoAug 26, 2013
  8. Jeff KingAug 26, 2013
  9. Jeff KingAug 26, 2013
  10. Jonathan NiederAug 26, 2013
  11. Jeff KingAug 26, 2013
  12. Junio C HamanoAug 27, 2013
  13. [PATCHv3] write_index: optionally allow broken null sha1sJeff King, Aug 27, 2013

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.