{"thread":{"id":"59817","subject":"git gc complains about \"unable to read $oid\" but git fsck finds no problems","startedAt":"2023-06-01T10:00:34Z","lastAt":"2023-06-01T10:38:21Z","messageCount":3,"participants":["Andreas Schwab","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"477866","messageId":"mvmfs7ba4el.fsf@suse.de","threadId":"59817","inReplyTo":null,"subject":"git gc complains about \"unable to read $oid\" but git fsck finds no problems","fromName":"Andreas Schwab","fromEmail":"schwab@suse.de","sentAt":"2023-06-01T10:00:18Z","receivedAt":"2023-06-01T10:00:34Z","isPatch":false,"sender":{"key":"schwab@suse.de","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"$ git count-objects -v -H\ncount: 2177\nsize: 17.75 MiB\nin-pack: 878690\npacks: 46\nsize-pack: 279.84 MiB\nprune-packable: 0\ngarbage: 0\nsize-garbage: 0 bytes\n$ git gc\nEnumerating objects: 866036, done.\nCounting objects: 100% (866036/866036), done.\nDelta compression using up to 8 threads\nCompressing objects: 100% (144924/144924), done.\nfatal: unable to read e8524e0483c8e65746888368f77f83d7a955ea87\nfatal: failed to run repack\n\nHow can I find out where the bad object is referenced to be able to get\nrid of it?  It is not part of the regular history, a re-clone of the\nremote repository does not fetch it.  git fsck --full --cache prints a\nlot of dangling commits, but still does not complain.  The error happens\nabout half way through writing out the new pack.\n\nThe repository is more than 10 years old and in regular use all that\ntime, including a lot of rebasing.  I have looked through all of the\nreflogs, but couldn't find the object there either.  git prune\n--expire=now and git reflog expire --all --stale-fix\n--expire-unreachable=all didn't help.\n\nThen I used the fresh clone to copy over all heads I know about, like\nrecreating the branches and replace refs, fetching all reflog entries.\nThat did not report any problems and git gc does not complain, but it\nhas about 14800 objects less.\n\nAny ideas?\n\n-- \nAndreas Schwab, SUSE Labs, schwab@suse.de\nGPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7\n\"And now for something completely different.\"\n"},{"id":"477867","messageId":"xmqqsfbba42c.fsf@gitster.g","threadId":"59817","inReplyTo":"mvmfs7ba4el.fsf@suse.de","subject":"Re: git gc complains about \"unable to read $oid\" but git fsck finds no problems","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-06-01T10:07:39Z","receivedAt":"2023-06-01T10:10:44Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I vaguely recall there was a recent threaad discussing fsck and\nnormal codepath doing different checks.\n\nDoes this look similar to what you have?  (sorry, I am running out\nof gas tonight to dig deeply myself).\n\nhttps://lore.kernel.org/git/20230330181716.GA3286761@coredump.intra.peff.net/\n\nAndreas Schwab <schwab@suse.de> writes:\n\n> $ git count-objects -v -H\n> count: 2177\n> size: 17.75 MiB\n> in-pack: 878690\n> packs: 46\n> size-pack: 279.84 MiB\n> prune-packable: 0\n> garbage: 0\n> size-garbage: 0 bytes\n> $ git gc\n> Enumerating objects: 866036, done.\n> Counting objects: 100% (866036/866036), done.\n> Delta compression using up to 8 threads\n> Compressing objects: 100% (144924/144924), done.\n> fatal: unable to read e8524e0483c8e65746888368f77f83d7a955ea87\n> fatal: failed to run repack\n>\n> How can I find out where the bad object is referenced to be able to get\n> rid of it?  It is not part of the regular history, a re-clone of the\n> remote repository does not fetch it.  git fsck --full --cache prints a\n> lot of dangling commits, but still does not complain.  The error happens\n> about half way through writing out the new pack.\n>\n> The repository is more than 10 years old and in regular use all that\n> time, including a lot of rebasing.  I have looked through all of the\n> reflogs, but couldn't find the object there either.  git prune\n> --expire=now and git reflog expire --all --stale-fix\n> --expire-unreachable=all didn't help.\n>\n> Then I used the fresh clone to copy over all heads I know about, like\n> recreating the branches and replace refs, fetching all reflog entries.\n> That did not report any problems and git gc does not complain, but it\n> has about 14800 objects less.\n>\n> Any ideas?\n"},{"id":"477870","messageId":"mvmbkhza2nb.fsf@suse.de","threadId":"59817","inReplyTo":"xmqqsfbba42c.fsf@gitster.g","subject":"Re: git gc complains about \"unable to read $oid\" but git fsck finds no problems","fromName":"Andreas Schwab","fromEmail":"schwab@suse.de","sentAt":"2023-06-01T10:38:16Z","receivedAt":"2023-06-01T10:38:21Z","isPatch":false,"sender":{"key":"schwab@suse.de","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"On Jun 01 2023, Junio C Hamano wrote:\n\n> I vaguely recall there was a recent threaad discussing fsck and\n> normal codepath doing different checks.\n>\n> Does this look similar to what you have?  (sorry, I am running out\n> of gas tonight to dig deeply myself).\n>\n> https://lore.kernel.org/git/20230330181716.GA3286761@coredump.intra.peff.net/\n\nThanks, that indeed looks similar.\n\n-- \nAndreas Schwab, SUSE Labs, schwab@suse.de\nGPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7\n\"And now for something completely different.\"\n"}]}