git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] fsck: mention file path for index errors

From
Jeff King <peff@peff.net>
Date
Jun 1, 2023, 14:04 UTC
Message-ID
<20230601140436.GB2458601@coredump.intra.peff.net>
In-Reply-To
<mvmzg5j8jkk.fsf@suse.de>
On Thu, Jun 01, 2023 at 02:15:39PM +0200, Andreas Schwab wrote:
Show 19 quoted lines
> 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
Previous: Andreas SchwabNext: Junio C Hamano
Message 14 of 19 in “Bug: fsck and repack don't agree when a worktree index extension is "broken"”
  1. Johannes SixtFeb 18, 2023
  2. 0/3 fsck index files from all worktreesJeff King, Feb 24, 2023
  3. 1/3 fsck: factor out index fsckJeff King, Feb 24, 2023
  4. 2/3 fsck: check index files in all worktreesJeff King, Feb 24, 2023
  5. Jeff KingFeb 24, 2023
  6. 3/3 fsck: mention file path for index errorsJeff King, Feb 24, 2023
  7. Eric SunshineMay 11, 2023
  8. Jeff KingMay 11, 2023
  9. Eric SunshineMay 11, 2023
  10. Jeff KingMay 11, 2023
  11. Eric SunshineJun 29, 2023
  12. Junio C HamanoJun 29, 2023
  13. Andreas SchwabJun 1, 2023
  14. Jeff KingJun 1, 2023
  15. Junio C HamanoFeb 24, 2023
  16. 4/3 fsck: check even zero-entry index filesJeff King, Feb 26, 2023
  17. Derrick StoleeFeb 27, 2023
  18. Junio C HamanoFeb 27, 2023
  19. Johannes SixtFeb 26, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.