git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Nicolas Pitre <nico@fluxnic.net>
Cc: Jonathan Nieder <jrnieder@gmail.com>, git@vger.kernel.org
Subject: Re: fetch and bundle don't work in (semi-)broken repo
Date: Wed, 20 Oct 2010 09:41:22 +0200	[thread overview]
Message-ID: <20101020074122.GC28166@pengutronix.de> (raw)
In-Reply-To: <alpine.LFD.2.00.1010192154200.2764@xanadu.home>

Hello Nico,

On Tue, Oct 19, 2010 at 11:06:50PM -0400, Nicolas Pitre wrote:
> On Tue, 19 Oct 2010, Jonathan Nieder wrote:
> 
> > Nicolas Pitre wrote:
> > 
> > >                                 But ideally you should simply find a 
> > > pack that contains the problematic object in another repository and 
> > > copy it with its index file into the broken repository.
> > 
> > I assume the object is gone for good, but if you have it in another
> > repo that would be interesting, too.
> > 
> > To be clear: I think the important data has been recovered from the
> > broken repo already in the form of patches (right?) so the question
> > at hand is whether it would be possible to teach git to do better at
> > recovering automatically.  Which might depend on the nature of the
> > missing objects.
> 
> Sure.  Given that it is possible to create a patch series, that means 
> that all the important objects are still available.  Therefore Git 
> should be able to produce the pack for the equivalent fetch/bundle as 
> well.
> 
> So the following patch should help.  I hope that Uwe still has a copy of 
> the broken repo to test this patch with.
> 
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index f8eba53..691c2f1 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -1299,6 +1299,15 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,
>  		src->data = read_sha1_file(src_entry->idx.sha1, &type, &sz);
>  		read_unlock();
>  		if (!src->data)
> +			if (src_entry->preferred_base) {
> +				/* 
> +				 * Those objects are not included in the
> +				 * resulting pack.  Be resilient and ignore
> +				 * them, in case the pack could be created
> +				 * nevertheless.
> +				 */
> +				return 0;
> +			}
>  			die("object %s cannot be read",
>  			    sha1_to_hex(src_entry->idx.sha1));
>  		if (sz != src_size)
Doesn't help :-(  I added a warning(...) before your return 0, and I
don't see it.  Probably this means this is not the problematic code
path.

The output with your patch applied is:
	user@hostname:~/path/linux-2.6$ ~/gsrc/git/bin-wrappers/git bundle create tra linus/master..sectionmismatches
	Counting objects: 118, done.
	error: unable to find 40aaeb204dc04d3cf15c060133f65538b43b13b0
	Delta compression using up to 8 threads.
	fatal: object 3cf4fa25ab3d078a49e9488effaebf571fa128da cannot be read
	error: pack-objects died

If you want I can provide you the broken repo.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2010-10-20  7:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-19 16:09 fetch and bundle don't work in (semi-)broken repo Uwe Kleine-König
2010-10-19 18:39 ` Jonathan Nieder
2010-10-19 20:11   ` Uwe Kleine-König
2010-10-19 20:48     ` Nicolas Pitre
2010-10-19 21:02       ` Jonathan Nieder
2010-10-20  3:06         ` Nicolas Pitre
2010-10-20  7:41           ` Uwe Kleine-König [this message]
2010-10-20 13:38             ` Nicolas Pitre
     [not found]               ` <20101020150810.GE19834@pengutronix.de>
     [not found]                 ` <alpine.LFD.2.00.1010201301130.2764@xanadu.home>
2010-10-21  7:11                   ` format-patch broken [Was: fetch and bundle don't work in (semi-)broken repo] Uwe Kleine-König
2010-10-21  8:12                     ` Uwe Kleine-König
2010-10-22  3:53                     ` Nicolas Pitre
2010-10-20  7:59       ` fetch and bundle don't work in (semi-)broken repo Uwe Kleine-König

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=20101020074122.GC28166@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=nico@fluxnic.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).