[PATCH] git-gui: fix worktree initialization with empty prefix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]