Skip to content

Commit 41e2edf

Browse files
committed
Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui: git-gui: Automatically spell check commit messages as the user types git-gui: support Git Gui.app under OS X 10.5 git-gui: Update German translation. git-gui: (i18n) Fix a bunch of still untranslated strings.
2 parents 6bc4c72 + 95b002e commit 41e2edf

File tree

12 files changed

+618
-84
lines changed

12 files changed

+618
-84
lines changed

git-gui/Makefile

Lines changed: 13 additions & 4 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
@@ -93,7 +94,14 @@ endif
9394

9495
TCL_PATH ?= tclsh
9596
TCLTK_PATH ?= wish
96-
TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
97+
98+
ifeq ($(uname_S),Darwin)
99+
TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app
100+
ifeq ($(shell expr "$(uname_R)" : '9\.'),2)
101+
TKFRAMEWORK = /System/Library/Frameworks/Tk.framework/Resources/Wish\ Shell.app
102+
endif
103+
TKEXECUTABLE = $(shell basename "$(TKFRAMEWORK)" .app)
104+
endif
97105

98106
ifeq ($(findstring $(MAKEFLAGS),s),s)
99107
QUIET_GEN =
@@ -147,7 +155,7 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS
147155
echo then >>$@+ && \
148156
echo ' 'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \
149157
echo else >>$@+ && \
150-
echo ' 'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/Wish'\' \
158+
echo ' 'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\' \
151159
'"$$0" "$$@"' >>$@+ && \
152160
echo fi >>$@+ && \
153161
chmod +x $@+ && \
@@ -157,14 +165,15 @@ Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-VARS \
157165
macosx/Info.plist \
158166
macosx/git-gui.icns \
159167
macosx/AppMain.tcl \
160-
$(TKFRAMEWORK)/Contents/MacOS/Wish
168+
$(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE)
161169
$(QUIET_GEN)rm -rf '$@' '$@'+ && \
162170
mkdir -p '$@'+/Contents/MacOS && \
163171
mkdir -p '$@'+/Contents/Resources/Scripts && \
164-
cp '$(subst ','\'',$(TKFRAMEWORK))/Contents/MacOS/Wish' \
172+
cp '$(subst ','\'',$(subst \,,$(TKFRAMEWORK)/Contents/MacOS/$(TKEXECUTABLE)))' \
165173
'$@'+/Contents/MacOS && \
166174
cp macosx/git-gui.icns '$@'+/Contents/Resources && \
167175
sed -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
176+
-e 's/@@GITGUI_TKEXECUTABLE@@/$(TKEXECUTABLE)/g' \
168177
macosx/Info.plist \
169178
>'$@'+/Contents/Info.plist && \
170179
sed -e 's|@@gitexecdir@@|$(gitexecdir_SQ)|' \

git-gui/git-gui.sh

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ set default_config(gui.pruneduringfetch) false
612612
set default_config(gui.trustmtime) false
613613
set default_config(gui.diffcontext) 5
614614
set default_config(gui.newbranchtemplate) {}
615+
set default_config(gui.spellingdictionary) {}
615616
set default_config(gui.fontui) [font configure font_ui]
616617
set default_config(gui.fontdiff) [font configure font_diff]
617618
set font_descs {
@@ -1683,6 +1684,7 @@ set is_quitting 0
16831684
proc do_quit {} {
16841685
global ui_comm is_quitting repo_config commit_type
16851686
global GITGUI_BCK_exists GITGUI_BCK_i
1687+
global ui_comm_spell
16861688
16871689
if {$is_quitting} return
16881690
set is_quitting 1
@@ -1710,6 +1712,12 @@ proc do_quit {} {
17101712
}
17111713
}
17121714
1715+
# -- Cancel our spellchecker if its running.
1716+
#
1717+
if {[info exists ui_comm_spell]} {
1718+
$ui_comm_spell stop
1719+
}
1720+
17131721
# -- Remove our editor backup, its not needed.
17141722
#
17151723
after cancel $GITGUI_BCK_i
@@ -2454,7 +2462,7 @@ $ctxm add separator
24542462
$ctxm add command \
24552463
-label [mc "Sign Off"] \
24562464
-command do_signoff
2457-
bind_button3 $ui_comm "tk_popup $ctxm %X %Y"
2465+
set ui_comm_ctxm $ctxm
24582466
24592467
# -- Diff Header
24602468
#
@@ -2857,6 +2865,30 @@ if {[winfo exists $ui_comm]} {
28572865
}
28582866
28592867
backup_commit_buffer
2868+
2869+
# -- If the user has aspell available we can drive it
2870+
# in pipe mode to spellcheck the commit message.
2871+
#
2872+
set spell_cmd [list |]
2873+
set spell_dict [get_config gui.spellingdictionary]
2874+
lappend spell_cmd aspell
2875+
if {$spell_dict ne {}} {
2876+
lappend spell_cmd --master=$spell_dict
2877+
}
2878+
lappend spell_cmd --mode=none
2879+
lappend spell_cmd --encoding=utf-8
2880+
lappend spell_cmd pipe
2881+
if {$spell_dict eq {none}
2882+
|| [catch {set spell_fd [open $spell_cmd r+]} spell_err]} {
2883+
bind_button3 $ui_comm [list tk_popup $ui_comm_ctxm %X %Y]
2884+
} else {
2885+
set ui_comm_spell [spellcheck::init \
2886+
$spell_fd \
2887+
$ui_comm \
2888+
$ui_comm_ctxm \
2889+
]
2890+
}
2891+
unset -nocomplain spell_cmd spell_fd spell_err spell_dict
28602892
}
28612893
28622894
lock_index begin-read

git-gui/lib/about.tcl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
proc do_about {} {
55
global appvers copyright oguilib
66
global tcl_patchLevel tk_patchLevel
7+
global ui_comm_spell
78

89
set w .about_dialog
910
toplevel $w
@@ -40,6 +41,10 @@ proc do_about {} {
4041
append v "Tcl version $tcl_patchLevel"
4142
append v ", Tk version $tk_patchLevel"
4243
}
44+
if {[info exists ui_comm_spell]} {
45+
append v "\n"
46+
append v [$ui_comm_spell version]
47+
}
4348

4449
set d {}
4550
append d "git wrapper: $::_git\n"

git-gui/lib/checkout_op.tcl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ The rescan will be automatically started now.
280280
} elseif {[is_config_true gui.trustmtime]} {
281281
_readtree $this
282282
} else {
283-
ui_status {Refreshing file status...}
283+
ui_status [mc "Refreshing file status..."]
284284
set fd [git_read update-index \
285285
-q \
286286
--unmerged \
@@ -320,7 +320,7 @@ method _readtree {} {
320320
set readtree_d {}
321321
$::main_status start \
322322
[mc "Updating working directory to '%s'..." [_name $this]] \
323-
{files checked out}
323+
[mc "files checked out"]
324324

325325
set fd [git_read --stderr read-tree \
326326
-m \
@@ -447,7 +447,7 @@ If you wanted to be on a branch, create one now starting from 'This Detached Che
447447
} else {
448448
repository_state commit_type HEAD MERGE_HEAD
449449
set PARENT $HEAD
450-
ui_status "Checked out '$name'."
450+
ui_status [mc "Checked out '%s'." $name]
451451
}
452452
delete_this
453453
}

git-gui/lib/commit.tcl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ A good commit message has the following format:
218218
return
219219
}
220220

221-
ui_status {Calling pre-commit hook...}
221+
ui_status [mc "Calling pre-commit hook..."]
222222
set pch_error {}
223223
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
224224
fileevent $fd_ph readable \
@@ -233,7 +233,7 @@ proc commit_prehook_wait {fd_ph curHEAD msg_p} {
233233
if {[eof $fd_ph]} {
234234
if {[catch {close $fd_ph}]} {
235235
catch {file delete $msg_p}
236-
ui_status {Commit declined by pre-commit hook.}
236+
ui_status [mc "Commit declined by pre-commit hook."]
237237
hook_failed_popup pre-commit $pch_error
238238
unlock_index
239239
} else {
@@ -256,7 +256,7 @@ proc commit_commitmsg {curHEAD msg_p} {
256256
return
257257
}
258258

259-
ui_status {Calling commit-msg hook...}
259+
ui_status [mc "Calling commit-msg hook..."]
260260
set pch_error {}
261261
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
262262
fileevent $fd_ph readable \
@@ -271,7 +271,7 @@ proc commit_commitmsg_wait {fd_ph curHEAD msg_p} {
271271
if {[eof $fd_ph]} {
272272
if {[catch {close $fd_ph}]} {
273273
catch {file delete $msg_p}
274-
ui_status {Commit declined by commit-msg hook.}
274+
ui_status [mc "Commit declined by commit-msg hook."]
275275
hook_failed_popup commit-msg $pch_error
276276
unlock_index
277277
} else {
@@ -284,7 +284,7 @@ proc commit_commitmsg_wait {fd_ph curHEAD msg_p} {
284284
}
285285

286286
proc commit_writetree {curHEAD msg_p} {
287-
ui_status {Committing changes...}
287+
ui_status [mc "Committing changes..."]
288288
set fd_wt [git_read write-tree]
289289
fileevent $fd_wt readable \
290290
[list commit_committree $fd_wt $curHEAD $msg_p]
@@ -301,7 +301,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
301301
if {[catch {close $fd_wt} err]} {
302302
catch {file delete $msg_p}
303303
error_popup [strcat [mc "write-tree failed:"] "\n\n$err"]
304-
ui_status {Commit failed.}
304+
ui_status [mc "Commit failed."]
305305
unlock_index
306306
return
307307
}
@@ -345,7 +345,7 @@ A rescan will be automatically started now.
345345
if {[catch {set cmt_id [eval git $cmd]} err]} {
346346
catch {file delete $msg_p}
347347
error_popup [strcat [mc "commit-tree failed:"] "\n\n$err"]
348-
ui_status {Commit failed.}
348+
ui_status [mc "Commit failed."]
349349
unlock_index
350350
return
351351
}
@@ -365,7 +365,7 @@ A rescan will be automatically started now.
365365
} err]} {
366366
catch {file delete $msg_p}
367367
error_popup [strcat [mc "update-ref failed:"] "\n\n$err"]
368-
ui_status {Commit failed.}
368+
ui_status [mc "Commit failed."]
369369
unlock_index
370370
return
371371
}

git-gui/lib/index.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ proc add_helper {txt paths} {
310310
update_index \
311311
$txt \
312312
$pathList \
313-
[concat $after {ui_status {Ready to commit.}}]
313+
[concat $after {ui_status [mc "Ready to commit."]}]
314314
}
315315
}
316316

git-gui/lib/merge.tcl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ method _start {} {
116116
lappend cmd HEAD
117117
lappend cmd $name
118118

119-
set msg [mc "Merging %s and %s" $current_branch $stitle]
120-
ui_status "$msg..."
119+
ui_status [mc "Merging %s and %s..." $current_branch $stitle]
121120
set cons [console::new [mc "Merge"] "merge $stitle"]
122121
console::exec $cons $cmd [cb _finish $cons]
123122

@@ -236,7 +235,7 @@ Continue with resetting the current changes?"]
236235
set fd [git_read --stderr read-tree --reset -u -v HEAD]
237236
fconfigure $fd -blocking 0 -translation binary
238237
fileevent $fd readable [namespace code [list _reset_wait $fd]]
239-
$::main_status start [mc "Aborting"] {files reset}
238+
$::main_status start [mc "Aborting"] [mc "files reset"]
240239
} else {
241240
unlock_index
242241
}

git-gui/lib/option.tcl

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ proc save_config {} {
55
global default_config font_descs
66
global repo_config global_config
77
global repo_config_new global_config_new
8+
global ui_comm_spell
89

910
foreach option $font_descs {
1011
set name [lindex $option 0]
@@ -52,11 +53,23 @@ proc save_config {} {
5253
set repo_config($name) $value
5354
}
5455
}
56+
57+
if {[info exists repo_config(gui.spellingdictionary)]} {
58+
set value $repo_config(gui.spellingdictionary)
59+
if {$value eq {none}} {
60+
if {[info exists ui_comm_spell]} {
61+
$ui_comm_spell stop
62+
}
63+
} elseif {[info exists ui_comm_spell]} {
64+
$ui_comm_spell lang $value
65+
}
66+
}
5567
}
5668

5769
proc do_options {} {
5870
global repo_config global_config font_descs
5971
global repo_config_new global_config_new
72+
global ui_comm_spell
6073

6174
array unset repo_config_new
6275
array unset global_config_new
@@ -159,6 +172,34 @@ proc do_options {} {
159172
}
160173
}
161174

175+
set all_dicts [linsert \
176+
[spellcheck::available_langs] \
177+
0 \
178+
none]
179+
incr optid
180+
foreach f {repo global} {
181+
if {![info exists ${f}_config_new(gui.spellingdictionary)]} {
182+
if {[info exists ui_comm_spell]} {
183+
set value [$ui_comm_spell lang]
184+
} else {
185+
set value none
186+
}
187+
set ${f}_config_new(gui.spellingdictionary) $value
188+
}
189+
190+
frame $w.$f.$optid
191+
label $w.$f.$optid.l -text [mc "Spelling Dictionary:"]
192+
eval tk_optionMenu $w.$f.$optid.v \
193+
${f}_config_new(gui.spellingdictionary) \
194+
$all_dicts
195+
pack $w.$f.$optid.l -side left -anchor w -fill x
196+
pack $w.$f.$optid.v -side left -anchor w \
197+
-fill x -expand 1 \
198+
-padx 5
199+
pack $w.$f.$optid -side top -anchor w -fill x
200+
}
201+
unset all_dicts
202+
162203
set all_fonts [lsort [font families]]
163204
foreach option $font_descs {
164205
set name [lindex $option 0]

0 commit comments

Comments
 (0)