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

Re: [PATCH] git-gui: Use PWD if it exists on Mac OS X.

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 9, 2012, 23:37 UTC
Message-ID
<7vty1x2vod.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1331335042-25509-1-git-send-email-mk@acc.umu.se>
Thanks, Marcus.

Just forwarding to the current maintainer; please note that my sign-off does not mean anything more than what D-C-O says it means; I rarely if ever use git-gui myself and do not have a Macintosh.

-- >8 --
From: Marcus Karlsson <mk@acc.umu.se>
Subject: [PATCH] git-gui: Use PWD if it exists on Mac OS X
Date: Sat, 10 Mar 2012 00:17:22 +0100

The current working directory is set to / when git-gui is invoked using the Git Gui.app bundle on Mac OS X. This means that if it is launched from a directory which contains a repository then git-gui won't automatically find it unless the repository happens to be located in /.

The PWD environment variable is however preserved if the bundle is invoked using open(1). If git-gui would check for PWD then a user could for example type open -a 'Git Gui' on a command line in order to launch the program and it would automatically find the repository.

Teach git-gui to use the PWD environment variable on Mac OS X.
Signed-off-by: Marcus Karlsson <mk@acc.umu.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-gui/macosx/AppMain.tcl |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/git-gui/macosx/AppMain.tcl b/git-gui/macosx/AppMain.tcl
index ddbe633..738bdd0 100644
--- a/git-gui/macosx/AppMain.tcl
+++ b/git-gui/macosx/AppMain.tcl
@@ -12,7 +12,9 @@ if {[file tail [lindex $argv 0]] eq {gitk}} {
 } else {
 	set argv0 [file join $gitexecdir [file tail [lindex $argv 0]]]
 	set AppMain_source [file join $gitguilib git-gui.tcl]
-	if {[pwd] eq {/}} {
+	if {[info exists env(PWD)]} {
+		cd $env(PWD)
+	} elseif {[pwd] eq {/}} {
 		cd $env(HOME)
 	}
 }
-- 
1.7.10.rc0.17.g36a9f
Previous: Marcus KarlssonNext: Pat Thoyts
Message 2 of 3 in “git-gui: Use PWD if it exists on Mac OS X.”
  1. git-gui: Use PWD if it exists on Mac OS X.Marcus Karlsson, Mar 9, 2012
  2. Junio C HamanoMar 9, 2012
  3. Pat ThoytsMar 10, 2012

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.