All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCHv2] write_index: optionally allow broken null sha1s
Date: Sun, 25 Aug 2013 23:03:54 -0700	[thread overview]
Message-ID: <xmqqob8lj8dx.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20130825195412.GA2752@elie.Belkin> (Jonathan Nieder's message of "Sun, 25 Aug 2013 12:54:12 -0700")

Jonathan Nieder <jrnieder@gmail.com> writes:

> 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.

  reply	other threads:[~2013-08-26  6:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-24  1:33 [PATCH] write_index: optionally allow broken null sha1s Jeff King
2013-08-25  6:15 ` Jonathan Nieder
2013-08-25  9:58   ` [PATCHv2] " Jeff King
2013-08-25 19:54     ` Jonathan Nieder
2013-08-26  6:03       ` Junio C Hamano [this message]
2013-08-26 14:31         ` Jeff King
2013-08-26 16:02           ` Junio C Hamano
2013-08-26 21:36             ` Jeff King
2013-08-26 14:27       ` Jeff King
2013-08-26 17:35         ` Jonathan Nieder
2013-08-26 21:20           ` Jeff King
2013-08-27  3:46             ` Junio C Hamano
2013-08-27 20:41             ` [PATCHv3] " Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqob8lj8dx.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.