Skip to content

Commit e98d6df

Browse files
committed
Merge branch 'maint' of git://repo.or.cz/git-gui into maint
* '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
2 parents 9ea0980 + 3baee1f commit e98d6df

File tree

5 files changed

+50
-15
lines changed

5 files changed

+50
-15
lines changed

git-gui/Makefile

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
1313

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

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

94-
TCL_PATH ?= tclsh
9595
TCLTK_PATH ?= wish
96-
TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
96+
ifeq (./,$(dir $(TCLTK_PATH)))
97+
TCL_PATH ?= $(subst wish,tclsh,$(TCLTK_PATH))
98+
else
99+
TCL_PATH ?= $(dir $(TCLTK_PATH))$(notdir $(subst wish,tclsh,$(TCLTK_PATH)))
100+
endif
101+
102+
ifeq ($(uname_S),Darwin)
103+
TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
104+
ifeq ($(shell expr "$(uname_R)" : '9\.'),2)
105+
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
106+
endif
107+
TKEXECUTABLE = $(shell basename "$(TKFRAMEWORK)" .app)
108+
endif
97109

98110
ifeq ($(findstring $(MAKEFLAGS),s),s)
99111
QUIET_GEN =
@@ -119,7 +131,17 @@ GITGUI_MACOSXAPP :=
119131

120132
ifeq ($(uname_O),Cygwin)
121133
GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"`
122-
gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)")
134+
135+
# Is this a Cygwin Tcl/Tk binary? If so it knows how to do
136+
# POSIX path translation just like cygpath does and we must
137+
# keep libdir in POSIX format so Cygwin packages of git-gui
138+
# work no matter where the user installs them.
139+
#
140+
ifeq ($(shell echo 'puts [file normalize /]' | '$(TCL_PATH_SQ)'),$(shell cygpath --mixed --absolute /))
141+
gg_libdir_sed_in := $(gg_libdir)
142+
else
143+
gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)")
144+
endif
123145
else
124146
ifeq ($(exedir),$(gg_libdir))
125147
GITGUI_RELATIVE := 1
@@ -147,7 +169,7 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS
147169
echo then >>$@+ && \
148170
echo ' 'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \
149171
echo else >>$@+ && \
150-
echo ' 'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/Wish'\' \
172+
echo ' 'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\' \
151173
'"$$0" "$$@"' >>$@+ && \
152174
echo fi >>$@+ && \
153175
chmod +x $@+ && \
@@ -157,14 +179,15 @@ Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-VARS \
157179
macosx/Info.plist \
158180
macosx/git-gui.icns \
159181
macosx/AppMain.tcl \
160-
$(TKFRAMEWORK)/Contents/MacOS/Wish
182+
$(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE)
161183
$(QUIET_GEN)rm -rf '$@' '$@'+ && \
162184
mkdir -p '$@'+/Contents/MacOS && \
163185
mkdir -p '$@'+/Contents/Resources/Scripts && \
164-
cp '$(subst ','\'',$(TKFRAMEWORK))/Contents/MacOS/Wish' \
186+
cp '$(subst ','\'',$(subst \,,$(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE)))' \
165187
'$@'+/Contents/MacOS && \
166188
cp macosx/git-gui.icns '$@'+/Contents/Resources && \
167189
sed -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
190+
-e 's/@@GITGUI_TKEXECUTABLE@@/$(TKEXECUTABLE)/g' \
168191
macosx/Info.plist \
169192
>'$@'+/Contents/Info.plist && \
170193
sed -e 's|@@gitexecdir@@|$(gitexecdir_SQ)|' \

git-gui/git-gui.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ if {![regsub {^git version } $_git_version {} _git_version]} {
662662
}
663663
664664
set _real_git_version $_git_version
665-
regsub -- {-dirty$} $_git_version {} _git_version
665+
regsub -- {[\-\.]dirty$} $_git_version {} _git_version
666666
regsub {\.[0-9]+\.g[0-9a-f]+$} $_git_version {} _git_version
667667
regsub {\.rc[0-9]+$} $_git_version {} _git_version
668668
regsub {\.GIT$} $_git_version {} _git_version

git-gui/lib/choose_repository.tcl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ field w_quit ; # Quit button
1111
field o_cons ; # Console object (if active)
1212
field w_types ; # List of type buttons in clone
1313
field w_recentlist ; # Listbox containing recent repositories
14+
field w_localpath ; # Entry widget bound to local_path
1415

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

389391
pack $w_body.where.b -side right
390392
pack $w_body.where.l -side left
@@ -416,6 +418,7 @@ method _new_local_path {} {
416418
return
417419
}
418420
set local_path $p
421+
$w_localpath icursor end
419422
}
420423

421424
method _do_new2 {} {
@@ -481,6 +484,7 @@ method _do_clone {} {
481484
-text [mc "Browse"] \
482485
-command [cb _new_local_path]
483486
grid $args.where_l $args.where_t $args.where_b -sticky ew
487+
set w_localpath $args.where_t
484488

485489
label $args.type_l -text [mc "Clone Type:"]
486490
frame $args.type_f

git-gui/lib/error.tcl

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# git-gui branch (create/delete) support
22
# Copyright (C) 2006, 2007 Shawn Pearce
33

4+
proc _error_parent {} {
5+
set p [grab current .]
6+
if {$p eq {}} {
7+
return .
8+
}
9+
return $p
10+
}
11+
412
proc error_popup {msg} {
513
set title [appname]
614
if {[reponame] ne {}} {
@@ -11,8 +19,8 @@ proc error_popup {msg} {
1119
-type ok \
1220
-title [append "$title: " [mc "error"]] \
1321
-message $msg]
14-
if {[winfo ismapped .]} {
15-
lappend cmd -parent .
22+
if {[winfo ismapped [_error_parent]]} {
23+
lappend cmd -parent [_error_parent]
1624
}
1725
eval $cmd
1826
}
@@ -27,13 +35,13 @@ proc warn_popup {msg} {
2735
-type ok \
2836
-title [append "$title: " [mc "warning"]] \
2937
-message $msg]
30-
if {[winfo ismapped .]} {
31-
lappend cmd -parent .
38+
if {[winfo ismapped [_error_parent]]} {
39+
lappend cmd -parent [_error_parent]
3240
}
3341
eval $cmd
3442
}
3543

36-
proc info_popup {msg {parent .}} {
44+
proc info_popup {msg} {
3745
set title [appname]
3846
if {[reponame] ne {}} {
3947
append title " ([reponame])"
@@ -56,8 +64,8 @@ proc ask_popup {msg} {
5664
-type yesno \
5765
-title $title \
5866
-message $msg]
59-
if {[winfo ismapped .]} {
60-
lappend cmd -parent .
67+
if {[winfo ismapped [_error_parent]]} {
68+
lappend cmd -parent [_error_parent]
6169
}
6270
eval $cmd
6371
}

git-gui/macosx/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<key>CFBundleDevelopmentRegion</key>
66
<string>English</string>
77
<key>CFBundleExecutable</key>
8-
<string>Wish</string>
8+
<string>@@GITGUI_TKEXECUTABLE@@</string>
99
<key>CFBundleGetInfoString</key>
1010
<string>Git Gui @@GITGUI_VERSION@@ © 2006-2007 Shawn Pearce, et. al.</string>
1111
<key>CFBundleIconFile</key>

0 commit comments

Comments
 (0)