Git Mailing List Archive mirror
 help / color / mirror / Atom feed
* Bug: fsck and repack don't agree when a worktree index extension is "broken"
@ 2023-02-18  9:38 Johannes Sixt
  2023-02-24  8:05 ` [PATCH 0/3] fsck index files from all worktrees Jeff King
  0 siblings, 1 reply; 19+ messages in thread
From: Johannes Sixt @ 2023-02-18  9:38 UTC (permalink / raw)
  To: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 1770 bytes --]

I came into a situation where a worktree index contains an invalid
object ID in an extension. This causes git gc to abort half-way:

$ git gc
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
fatal: unable to read d3e1a3edd7d7851bbf811064090e03475d62fd44
fatal: failed to run repack

However, fsck does not find any problem:

$ git fsck
Checking object directories: 100% (256/256), done.

The problem is an invalid object ID that occurs in a worktree index. If
I copy the index to the main worktree, fsck does find the culprit:

$ cp .git/worktrees/wt/index .git/index
$ git fsck
Checking object directories: 100% (256/256), done.
error: d3e1a3edd7d7851bbf811064090e03475d62fd44: invalid sha1 pointer in
resolve-undo
error: 4b40bf1072d6dfeebc09b11ee4d4f22ca2ce3109: invalid sha1 pointer in
resolve-undo
error: 5a494fd3a2182795e0723300ab1ac75c0797be5b: invalid sha1 pointer in
resolve-undo

and git gc fails in the same way as before (of course).

I see three problems here:

- git fsck should detect the problem (if it really is one) in the
worktree index. It seems that it is just an index extension that is
affected. Perhaps it should be just a warning, not an error.

- If the objects mentioned in the index extension are precious, they
should not have been garbage-collected in earlier rounds of git gc
(which I certainly did at some point).

- I can't git gc the repository now, which is particularly annoying when
auto-gc is attempted after almost every git command. Of course, I know
how to get out of the situation, but it took some time to identify the
worktree index as the culprit. Not something that a beginner would be
able to do easily.

The repository I use for the above commands is attached. I hope vger
doesn't strip it away.

-- Hannes

[-- Attachment #2: git-bug-gc-w-worktree-index.tar.gz --]
[-- Type: application/gzip, Size: 3431 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2023-06-29 19:37 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).