Re: [PATCH v2 2/3] worktree add: stop reading ".git/HEAD"
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 16, 2026, 07:39 UTC
- Message-ID
- <abeztWLCxdWADCJ8@pks.im>
- In-Reply-To
- <c3c5767725d6d3b31604fbd0dd29486b70bc18a1.1773591528.git.phillip.wood@dunelm.org.uk>
On Sun, Mar 15, 2026 at 04:18:51PM +0000, Phillip Wood wrote:
Show 12 quoted lines
> From: Phillip Wood <phillip.wood@dunelm.org.uk> > > The function can_use_local_refs() prints a warning if there are no local > branches and HEAD is invalid or points to an unborn branch. As part of > the warning it prints the contents of ".git/HEAD". In a repository using > the reftable backend HEAD is not stored in the filesystem so reading > that file is pointless. In a repository using the files backend it is > unclear how useful printing it is - it would be better to diagnose the > problem for the user. For now, simplify the warning by not printing > the file contents and adjust the relevant test case accordingly. Also > fixup the test case to use test_grep so that anyone trying to debug a > test failure in the future is not met by a wall of silence.
Oh, interesting, and good catch. I fully agree that removing this makes sense.
Patrick