From: Junio C Hamano Date: Sun, 01 Feb 2009 00:53:12 GMT Subject: Re: [PATCH 1/2] fsck: HEAD is part of refs Message-ID: <7v3aez3rlz.fsf@gitster.siamese.dyndns.org> In-Reply-To: <4982C7FA.20107@viscovery.net> Johannes Sixt writes: > Junio C Hamano schrieb: >> By default we looked at all refs but not HEAD. The only thing that >> made fsck not lose sight of comments that are only reachable from a >> detached HEAD was the reflog for the HEAD. >> >> This fixes it, with a new test. > [...] >> +test_expect_success setup ' >> + test_commit A && >> + git checkout HEAD^0 && >> + test_commit B && >> + git reflog expire --expire=now --all >> +' >> + >> +test_expect_success 'HEAD is part of refs' ' >> + test 0 = $(git fsck | wc -l) > > I'm scratching my head over this. This test succeeds even without the > change... (Tested with a34a9db.) You are right. I forgot that test_commit creates an extra tag. By adding git tag -d B && after "test_commit B &&", you would expose the issue in the existing code.