summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Karlsson <mk@acc.umu.se>2012-03-10 00:17:22 +0100
committerPat Thoyts <patthoyts@users.sourceforge.net>2012-03-10 23:16:24 +0000
commit446f8226ddb4f1d6e5ce14fb8cc22695af08e32b (patch)
treeade9bcdb01e11c8dc6519df18a7910d631299acc
parentba5d445b653f874d9e4f2fd97fdd87438f45a70d (diff)
downloadgit-446f8226ddb4f1d6e5ce14fb8cc22695af08e32b.tar.gz
git-gui: Use PWD if it exists on Mac OS X
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> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
-rw-r--r--macosx/AppMain.tcl4
1 files changed, 3 insertions, 1 deletions
diff --git a/macosx/AppMain.tcl b/macosx/AppMain.tcl
index ddbe6334a2..738bdd03ed 100644
--- a/macosx/AppMain.tcl
+++ b/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)
}
}