Skip to content

Commit

Permalink
Merge branch 'maint' of git://repo.or.cz/git-gui into maint
Browse files Browse the repository at this point in the history
* 'maint' of git://repo.or.cz/git-gui:
  git-gui: Focus insertion point at end of strings in repository chooser
  git-gui: Avoid hardcoded Windows paths in Cygwin package files
  git-gui: Default TCL_PATH to same location as TCLTK_PATH
  git-gui: Paper bag fix error dialogs opening over the main window
  git-gui: Ensure error dialogs always appear over all other windows
  git-gui: relax "dirty" version detection
  git-gui: support Git Gui.app under OS X 10.5
  • Loading branch information
gitster committed Feb 23, 2008
2 parents 9ea0980 + 3baee1f commit e98d6df
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 15 deletions.
35 changes: 29 additions & 6 deletions git-gui/Makefile
Expand Up @@ -13,6 +13,7 @@ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE

uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')

SCRIPT_SH = git-gui.sh
GITGUI_MAIN := git-gui
Expand Down Expand Up @@ -91,9 +92,20 @@ ifndef V
REMOVE_F1 = && echo ' ' REMOVE `basename "$$dst"` && $(RM_RF) "$$dst"
endif

TCL_PATH ?= tclsh
TCLTK_PATH ?= wish
TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
ifeq (./,$(dir $(TCLTK_PATH)))
TCL_PATH ?= $(subst wish,tclsh,$(TCLTK_PATH))
else
TCL_PATH ?= $(dir $(TCLTK_PATH))$(notdir $(subst wish,tclsh,$(TCLTK_PATH)))
endif

ifeq ($(uname_S),Darwin)
TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
ifeq ($(shell expr "$(uname_R)" : '9\.'),2)
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
endif
TKEXECUTABLE = $(shell basename "$(TKFRAMEWORK)" .app)
endif

ifeq ($(findstring $(MAKEFLAGS),s),s)
QUIET_GEN =
Expand All @@ -119,7 +131,17 @@ GITGUI_MACOSXAPP :=

ifeq ($(uname_O),Cygwin)
GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"`
gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)")

# Is this a Cygwin Tcl/Tk binary? If so it knows how to do
# POSIX path translation just like cygpath does and we must
# keep libdir in POSIX format so Cygwin packages of git-gui
# work no matter where the user installs them.
#
ifeq ($(shell echo 'puts [file normalize /]' | '$(TCL_PATH_SQ)'),$(shell cygpath --mixed --absolute /))
gg_libdir_sed_in := $(gg_libdir)
else
gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)")
endif
else
ifeq ($(exedir),$(gg_libdir))
GITGUI_RELATIVE := 1
Expand Down Expand Up @@ -147,7 +169,7 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS
echo then >>$@+ && \
echo ' 'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \
echo else >>$@+ && \
echo ' 'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/Wish'\' \
echo ' 'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\' \
'"$$0" "$$@"' >>$@+ && \
echo fi >>$@+ && \
chmod +x $@+ && \
Expand All @@ -157,14 +179,15 @@ Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-VARS \
macosx/Info.plist \
macosx/git-gui.icns \
macosx/AppMain.tcl \
$(TKFRAMEWORK)/Contents/MacOS/Wish
$(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE)
$(QUIET_GEN)rm -rf '$@' '$@'+ && \
mkdir -p '$@'+/Contents/MacOS && \
mkdir -p '$@'+/Contents/Resources/Scripts && \
cp '$(subst ','\'',$(TKFRAMEWORK))/Contents/MacOS/Wish' \
cp '$(subst ','\'',$(subst \,,$(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE)))' \
'$@'+/Contents/MacOS && \
cp macosx/git-gui.icns '$@'+/Contents/Resources && \
sed -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
-e 's/@@GITGUI_TKEXECUTABLE@@/$(TKEXECUTABLE)/g' \
macosx/Info.plist \
>'$@'+/Contents/Info.plist && \
sed -e 's|@@gitexecdir@@|$(gitexecdir_SQ)|' \
Expand Down
2 changes: 1 addition & 1 deletion git-gui/git-gui.sh
Expand Up @@ -662,7 +662,7 @@ if {![regsub {^git version } $_git_version {} _git_version]} {
}
set _real_git_version $_git_version
regsub -- {-dirty$} $_git_version {} _git_version
regsub -- {[\-\.]dirty$} $_git_version {} _git_version
regsub {\.[0-9]+\.g[0-9a-f]+$} $_git_version {} _git_version
regsub {\.rc[0-9]+$} $_git_version {} _git_version
regsub {\.GIT$} $_git_version {} _git_version
Expand Down
4 changes: 4 additions & 0 deletions git-gui/lib/choose_repository.tcl
Expand Up @@ -11,6 +11,7 @@ field w_quit ; # Quit button
field o_cons ; # Console object (if active)
field w_types ; # List of type buttons in clone
field w_recentlist ; # Listbox containing recent repositories
field w_localpath ; # Entry widget bound to local_path

field done 0 ; # Finished picking the repository?
field local_path {} ; # Where this repository is locally
Expand Down Expand Up @@ -385,6 +386,7 @@ method _do_new {} {
button $w_body.where.b \
-text [mc "Browse"] \
-command [cb _new_local_path]
set w_localpath $w_body.where.t

pack $w_body.where.b -side right
pack $w_body.where.l -side left
Expand Down Expand Up @@ -416,6 +418,7 @@ method _new_local_path {} {
return
}
set local_path $p
$w_localpath icursor end
}

method _do_new2 {} {
Expand Down Expand Up @@ -481,6 +484,7 @@ method _do_clone {} {
-text [mc "Browse"] \
-command [cb _new_local_path]
grid $args.where_l $args.where_t $args.where_b -sticky ew
set w_localpath $args.where_t

label $args.type_l -text [mc "Clone Type:"]
frame $args.type_f
Expand Down
22 changes: 15 additions & 7 deletions git-gui/lib/error.tcl
@@ -1,6 +1,14 @@
# git-gui branch (create/delete) support
# Copyright (C) 2006, 2007 Shawn Pearce

proc _error_parent {} {
set p [grab current .]
if {$p eq {}} {
return .
}
return $p
}

proc error_popup {msg} {
set title [appname]
if {[reponame] ne {}} {
Expand All @@ -11,8 +19,8 @@ proc error_popup {msg} {
-type ok \
-title [append "$title: " [mc "error"]] \
-message $msg]
if {[winfo ismapped .]} {
lappend cmd -parent .
if {[winfo ismapped [_error_parent]]} {
lappend cmd -parent [_error_parent]
}
eval $cmd
}
Expand All @@ -27,13 +35,13 @@ proc warn_popup {msg} {
-type ok \
-title [append "$title: " [mc "warning"]] \
-message $msg]
if {[winfo ismapped .]} {
lappend cmd -parent .
if {[winfo ismapped [_error_parent]]} {
lappend cmd -parent [_error_parent]
}
eval $cmd
}

proc info_popup {msg {parent .}} {
proc info_popup {msg} {
set title [appname]
if {[reponame] ne {}} {
append title " ([reponame])"
Expand All @@ -56,8 +64,8 @@ proc ask_popup {msg} {
-type yesno \
-title $title \
-message $msg]
if {[winfo ismapped .]} {
lappend cmd -parent .
if {[winfo ismapped [_error_parent]]} {
lappend cmd -parent [_error_parent]
}
eval $cmd
}
Expand Down
2 changes: 1 addition & 1 deletion git-gui/macosx/Info.plist
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Wish</string>
<string>@@GITGUI_TKEXECUTABLE@@</string>
<key>CFBundleGetInfoString</key>
<string>Git Gui @@GITGUI_VERSION@@ © 2006-2007 Shawn Pearce, et. al.</string>
<key>CFBundleIconFile</key>
Expand Down

0 comments on commit e98d6df

Please sign in to comment.