From: Giuseppe Bilotta Date: Mon, 22 Feb 2010 15:19:24 GMT Subject: [PATCH] git-gui: fix worktree initialization with empty prefix Message-ID: <1266851964-13044-1-git-send-email-giuseppe.bilotta@gmail.com> In-Reply-To: This is sort of a chicken-and-egg problem, because we should only bother setting the worktree if we are not in a bare repository, but an unset worktree is one of the conditions we check to see if we have a bare repository. Maintain the same sequence of checks, but swap the check for bareness support and bareness of repository, and check again for an unset worktree if we are not in the bare case. --- git-gui/git-gui.sh | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index 7d54511..d9e1598 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -1169,12 +1169,13 @@ if {$_prefix ne {}} { } set _gitworktree [pwd] unset cdup -} elseif {![is_enabled bare]} { - if {[is_bare]} { +} elseif {[is_bare]} { + if {![is_enabled bare]} { catch {wm withdraw .} error_popup [strcat [mc "Cannot use bare repository:"] "\n\n$_gitdir"] exit 1 } +} else { if {$_gitworktree eq {}} { set _gitworktree [file dirname $_gitdir] } -- 1.7.0.198.g1e558.dirty