Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: `git gc` says "unable to read" but `git fsck` happy
Date: Thu, 30 Mar 2023 09:01:39 -0400	[thread overview]
Message-ID: <jwvfs9mz9n7.fsf-monnier+Inbox@gnu.org> (raw)
In-Reply-To: <20230329233735.GD2314218@coredump.intra.peff.net> (Jeff King's message of "Wed, 29 Mar 2023 19:37:35 -0400")

>> How come it can't read `f5e44b38fc8f7e15e5e6718090d05b09912254fa` during
>> "repack" while `git fsck` says everything is fine?
>
> Do you use separate worktrees?

Very much so, indeed!

> It sounds like it might be similar to this case:
>
>   https://lore.kernel.org/git/c6246ed5-bffc-7af9-1540-4e2071eff5dc@kdbg.org/

That's sounds exactly right.  I was actually preparing to file
a separate bug report because of a similar problem I had identified
where a worktree's `index` caused a similar problem (`git fsck` happy
but `git gc` fails) except it was found much earlier in `git gc`,
causing a "bad object" error almost right away.

> If so, there are patches in the current "master" (but not in a released
> version yet) that fix fsck to detect this.

Good, thanks.

>> More importantly: how do I diagnose this further and fix it?
>
> If it is the same problem (which would be a blob or maybe cached tree
> missing in one of the worktree's index files), then probably you'd
> either:
>
>   1. Accept the loss and blow away that worktree's index file (or
>      perhaps even the whole worktree, and just recreate it).

Hmm... the problem is "that": I have about a hundred worktrees for
this repository.
But yes, I can just throw away all those `index` files, I guess.

>      (assuming that the file itself is still hanging around).
> The original corruption bug itself (gc not taking into account worktree
> index files) has been fixed for a while, so the theory is that this can
> be lingering corruption from a repack by an older version of Git. But if
> you have evidence to the contrary, we'd like to hear that, too. ;)

My suspicion is that the origin of the broken state is elsewhere (maybe
a power failure?) because the problem appeared "simultaneously" (a few
days apart, really) for two different repositories.

> I don't think --aggressive would help at all. In theory --prune=now
> might, but I think even that won't help if the problem is that the
> object is referenced in an index file.

Indeed, I had also tried `--prune=now` and it did not help.
Thanks,


        Stefan


  reply	other threads:[~2023-03-30 13:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 22:05 `git gc` says "unable to read" but `git fsck` happy Stefan Monnier
2023-03-29 23:37 ` Jeff King
2023-03-30 13:01   ` Stefan Monnier [this message]
2023-03-30 18:17     ` Jeff King
2023-06-01 12:04       ` Andreas Schwab

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=jwvfs9mz9n7.fsf-monnier+Inbox@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=git@vger.kernel.org \
    --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 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 read-only IMAP folder(s) and NNTP newsgroup(s).