git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: [BUG] "fatal: bad object .alternate" during fetch with alternates
Date: Wed, 6 Nov 2019 15:59:07 -0500	[thread overview]
Message-ID: <20191106205907.GA4122@sigill.intra.peff.net> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1911041053190.46@tvgsbejvaqbjf.bet>

On Wed, Nov 06, 2019 at 08:48:05PM +0100, Johannes Schindelin wrote:

> Now, I think the two factors that trigger this bug over here are:
> 
> - I had all the objects locally already, as I had pushed from a topic
>   branch to `master` [*1*].
> 
> - My worktree's `.git/objects` is connected to an alternate that is
>   connected to the current Git repository (yes, it is circular, long
>   story...) and has refs pointing to commits its alternate that have
>   been gc'ed away.

I think this second one is the crux of the issue. Your alternate is a
corrupt repository, and I don't think that's something we ought to be
worried about supporting in general.

That said, those alternate objects should be used as UNINTERESTING
traversal tips. And rev-list usually tries to avoid bailing out for
missing UNINTERESTING objects. I suspect it's less aggressive about
doing so for the actual tips (because usually for_each_ref()'s internal
logic would skip broken refs entirely).

> So I see two problems with this error message:
> 
> - It is not helpful. It should not say `.alternate`, it should mention
>   the ref itself, and ideally even the path of the alternate.

It doesn't know the refname. The data transfer between the alternate and
the borrowing repo was tightened to just pass over object names. We
could probably pass the alternate path, though.

> - Shouldn't the code be made smart enough to simply ignore (maybe with a
>   warning) refs that point to gc'ed commits?

I'll take a look at the rev-list thing I mentioned above.

-Peff

  reply	other threads:[~2019-11-06 20:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 19:48 [BUG] "fatal: bad object .alternate" during fetch with alternates Johannes Schindelin
2019-11-06 20:59 ` Jeff King [this message]
2019-11-06 21:25   ` Jeff King
2019-11-06 21:42   ` Jeff King
2019-11-07 12:58     ` Johannes Schindelin
2019-11-08  8:54       ` 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=20191106205907.GA4122@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    /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).