Subject: Re: [PATCH v2 2/3] worktree add: stop reading ".git/HEAD"

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 16 Mar 2026 08:39:33 +0100

On Sun, Mar 15, 2026 at 04:18:51PM +0000, Phillip Wood wrote:
> From: Phillip Wood <[email-masked]>
> 
> 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