Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Andreas Schwab <schwab@suse.de>
Cc: Johannes Sixt <j6t@kdbg.org>, Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 3/3] fsck: mention file path for index errors
Date: Thu, 1 Jun 2023 10:04:36 -0400	[thread overview]
Message-ID: <20230601140436.GB2458601@coredump.intra.peff.net> (raw)
In-Reply-To: <mvmzg5j8jkk.fsf@suse.de>

On Thu, Jun 01, 2023 at 02:15:39PM +0200, Andreas Schwab wrote:

> On Feb 24 2023, Jeff King wrote:
> 
> > If we encounter an error in an index file, we may say something like:
> >
> >   error: 1234abcd: invalid sha1 pointer in resolve-undo
> >
> > But if you have multiple worktrees, each with its own index, it can be
> > very helpful to know which file had the problem. So let's pass that path
> > down through the various index-fsck functions and use it where
> > appropriate. After this patch you should get something like:
> >
> >   error: 1234abcd: invalid sha1 pointer in resolve-undo of .git/worktrees/wt/index
> 
> That is still suboptimal, because there is no obvious mapping from the
> internal worktree name to the directory where it lives (git worktree
> list doesn't mention the internal name).  If you have several worktrees
> with the same base name in different places, the name under
> .git/worktrees is just made unique by appending a number.  Normally you
> would want to change to the affected worktree directory to repair it.

I don't use worktrees all that much, and I never had to repair one of
these cases in the real world, but I would have imagined you'd chdir
into the affected .git directory to fix things (either by blowing away
the index, or by running Git commands inside there).

I don't think it would be too hard to print more information. The caller
of fsck_index() has the "struct worktree", which contains more path
information. But we'd need to figure out how to present it, as well as
which paths to show in fsck_cache_tree(), etc.

So I'd say "patches welcome" if anybody wants to figure out those
issues. :)

-Peff

  reply	other threads:[~2023-06-01 14:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-18  9:38 Bug: fsck and repack don't agree when a worktree index extension is "broken" Johannes Sixt
2023-02-24  8:05 ` [PATCH 0/3] fsck index files from all worktrees Jeff King
2023-02-24  8:07   ` [PATCH 1/3] fsck: factor out index fsck Jeff King
2023-02-24  8:09   ` [PATCH 2/3] fsck: check index files in all worktrees Jeff King
2023-02-24  8:45     ` Jeff King
2023-02-24  8:12   ` [PATCH 3/3] fsck: mention file path for index errors Jeff King
2023-05-11  6:39     ` Eric Sunshine
2023-05-11 16:17       ` Jeff King
2023-05-11 16:28         ` Eric Sunshine
2023-05-11 17:01           ` Jeff King
2023-06-29 18:21             ` Eric Sunshine
2023-06-29 19:37               ` Junio C Hamano
2023-06-01 12:15     ` Andreas Schwab
2023-06-01 14:04       ` Jeff King [this message]
2023-02-24 17:30   ` [PATCH 0/3] fsck index files from all worktrees Junio C Hamano
2023-02-26 22:29     ` [PATCH 4/3] fsck: check even zero-entry index files Jeff King
2023-02-27 12:09       ` Derrick Stolee
2023-02-27 15:58       ` Junio C Hamano
2023-02-26 21:49   ` [PATCH 0/3] fsck index files from all worktrees Johannes Sixt

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=20230601140436.GB2458601@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=schwab@suse.de \
    /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).