Re: [PATCH v7 2/3] git-gui: disable gitk visualization when no worktree available
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- May 15, 2026, 08:28 UTC
- Message-ID
- <f02e354d-a182-4207-8723-e5261e19351b@kdbg.org>
- In-Reply-To
- <tencent_A6BA86DF71476C6948398C167C0E0919550A@qq.com>
Am 09.05.26 um 15:37 schrieb Shroom Moo:
Show 6 quoted lines
> When git-gui is started in a bare repository with the 'bare' option > enabled (e.g., for blame/browser), there is no working tree. The > "Visualize Current Branch's History" and "Visualize All Branch > History" menu items remain enabled, but clicking them triggers a Tcl > error because do_gitk tries to change directory to an empty > _gitworktree.
I cannot reproduce this claim. The failure is not a Tcl error, but an error in some `git` invocation that cannot handle an empty GIT_WORK_TREE. And that happens only beginning with the *second* invocation of one of the "Visualize" calls, because then an empty GIT_WORK_TREE is exported into the environment.
Show 6 quoted lines
> > Fix this by disabling the two visualization menu items when the > repository is bare and the 'bare' option is active. Also update > current_branch_write to keep the state consistent when the branch > changes, and add a defensive check in do_gitk to avoid the error > should the menu state somehow become out of sync.
This change is not correct. Gitk can operate without a working tree. The menu entries should not be disabled, ever. The bug is somewhere else.
See also my suggested replacement patch in my reply to 3/3.
-- Hannes