Skip to content

Commit 446f822

Browse files
Marcus Karlssonpatthoyts
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Pat Thoyts <[email protected]>
1 parent ba5d445 commit 446f822

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

macosx/AppMain.tcl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ if {[file tail [lindex $argv 0]] eq {gitk}} {
1212
} else {
1313
set argv0 [file join $gitexecdir [file tail [lindex $argv 0]]]
1414
set AppMain_source [file join $gitguilib git-gui.tcl]
15-
if {[pwd] eq {/}} {
15+
if {[info exists env(PWD)]} {
16+
cd $env(PWD)
17+
} elseif {[pwd] eq {/}} {
1618
cd $env(HOME)
1719
}
1820
}

0 commit comments

Comments
 (0)