git-gui: remove unnecessary 'cd $_gitworktree' from do_gitk

In the procedure that invokes Gitk, we have a 'cd $_gitworktree'. Such a change of the current directory is not necessary, because - if we have a working tree, then the startup routine has already changed the current directory to the root of the working tree, which *is* $_gitworktree; or - if we are in a bare repository, then there is no point in changing the current directory anywhere. (And $_gitworktree is empty.) Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org>

Johannes Sixt committed May 31, 2026 at 19:02 UTC a7e5d892034b6e81dbbbaed09fdbade12352157b
1 file changed +1 -5
git-gui.sh
+1 -5
@@ -2024,11 +2024,7 @@ proc do_gitk {revs {is_submodule false}} {
2024
2025 set pwd [pwd]
2026
2027 - if {!$is_submodule} {
2028 - if {![is_bare]} {
2029 - cd $_gitworktree
2030 - }
2031 - } else {
2027 + if {$is_submodule} {
2028 cd $current_diff_path
2029 if {$revs eq {--}} {
2030 set s $file_states($current_diff_path)