From: Johannes Sixt Date: Sat, 23 May 2026 14:08:28 GMT Subject: Re: [PATCH v2 08/11] git-gui: use HEAD as current branch when detached (bug fix) Message-ID: In-Reply-To: <20260520202411.108764-9-mlevedahl@gmail.com> Am 20.05.26 um 22:24 schrieb Mark Levedahl: > commit f87a36b697 ("git-gui: use git-branch --show-current", 2024-02-12) > changed git-gui to use git-branch to access refs, rather than directly > reading files as doing the latter is not compatible with the reftable > backend. git branch --show-current reports an empty branch name when the > head is detached, and in this case load_current_branch needs to report > HEAD using special case logic as it did prior to the above commit. Make > it do so. > > This addresses an issue with git-gui browser failing with a detached > head. Nice catch. I'll reorder this as the first commit. > > Signed-off-by: Mark Levedahl > --- > git-gui.sh | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/git-gui.sh b/git-gui.sh > index aeb7ed3548..a72d8a59ec 100755 > --- a/git-gui.sh > +++ b/git-gui.sh > @@ -648,6 +648,9 @@ proc load_current_branch {} { > > set current_branch [git branch --show-current] > set is_detached [expr [string length $current_branch] == 0] > + if {$is_detached} { > + set current_branch {HEAD} > + } > } > > auto_load tk_optionMenu -- Hannes