git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date
Feb 22, 2010, 15:19 UTC
Message-ID
<1266851964-13044-1-git-send-email-giuseppe.bilotta@gmail.com>
In-Reply-To
<vpqaav1llpn.fsf@bauges.imag.fr>

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
Previous: Heiko VoigtNext: Matthieu Moy
Message 7 of 9 in “[BUG] git gui blame: Show History Context broken since 29e5573d”
  1. Matthieu MoyFeb 22, 2010
  2. Giuseppe BilottaFeb 22, 2010
  3. Heiko VoigtFeb 22, 2010
  4. Giuseppe BilottaFeb 22, 2010
  5. Matthieu MoyFeb 23, 2010
  6. Heiko VoigtFeb 23, 2010
  7. git-gui: fix worktree initialization with empty prefixGiuseppe Bilotta, Feb 22, 2010
  8. Matthieu MoyFeb 22, 2010
  9. Giuseppe BilottaFeb 22, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.