git/macosx/AppMain.tcl
Shawn O. Pearce 7838d3fb41 git-gui: Correct 'Visualize Branches' on Mac OS X to start gitk
In Git 1.6 and later gitk is in $prefix/bin while git-gui and all
of the other commands are in $gitexecdir, which is typically not
the same as $prefix/bin.  So we cannot launch $gitexecdir/gitk and
expect it to actually start gitk properly.

By allowing git-gui to locate the script via $PATH and then using
exactly that path when we source it during the application start
we can correctly run gitk on any Git 1.5 or later.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-07-25 15:08:33 -07:00

23 lines
556 B
Tcl

set gitexecdir {@@gitexecdir@@}
set gitguilib {@@GITGUI_LIBDIR@@}
set env(PATH) "$gitexecdir:$env(PATH)"
if {[string first -psn [lindex $argv 0]] == 0} {
lset argv 0 [file join $gitexecdir git-gui]
}
if {[file tail [lindex $argv 0]] eq {gitk}} {
set argv0 [lindex $argv 0]
set AppMain_source $argv0
} else {
set argv0 [file join $gitexecdir [file tail [lindex $argv 0]]]
set AppMain_source [file join $gitguilib git-gui.tcl]
if {[pwd] eq {/}} {
cd $env(HOME)
}
}
unset gitexecdir gitguilib
set argv [lrange $argv 1 end]
source $AppMain_source