Skip to content

Commit 12644fa

Browse files
committed
Merge git://repo.or.cz/git-gui
* 'master' of git://repo.or.cz/git-gui: git-gui 0.13 git-gui: avoid mis-encoding the copyright message on Windows. git-gui: Update Swedish translation (521t). git-gui: ensure correct application termination in git-gui--askpass git-gui: handle textconv filter on Windows and in development git-gui: use shell to launch textconv filter in "blame" git-gui: display error launching blame as a message box. git-gui: Make usage statement visible on Windows.
2 parents 5879b6b + 00e9de7 commit 12644fa

File tree

6 files changed

+454
-411
lines changed

6 files changed

+454
-411
lines changed

git-gui/GIT-VERSION-GEN

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
GVF=GIT-VERSION-FILE
4-
DEF_VER=0.12.GITGUI
4+
DEF_VER=0.13.GITGUI
55

66
LF='
77
'

git-gui/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ endif
215215
$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-VARS
216216
$(QUIET_GEN)rm -f $@ $@+ && \
217217
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
218+
-e 's|@@SHELL_PATH@@|$(SHELL_PATH_SQ)|' \
218219
-e '1,30s|^ argv0=$$0| argv0=$(GITGUI_SCRIPT)|' \
219220
-e '1,30s|^ exec wish | exec '\''$(TCLTK_PATH_SED)'\'' |' \
220221
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \

git-gui/git-gui--askpass

+13-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ exec wish "$0" -- "$@"
55
# This is a trivial implementation of an SSH_ASKPASS handler.
66
# Git-gui uses this script if none are already configured.
77

8+
package require Tk
9+
810
set answer {}
911
set yesno 0
1012
set rc 255
@@ -30,16 +32,20 @@ if {!$yesno} {
3032

3133
frame .b
3234
button .b.ok -text OK -command finish
33-
button .b.cancel -text Cancel -command {destroy .}
35+
button .b.cancel -text Cancel -command cancel
3436

3537
pack .b.ok -side left -expand 1
3638
pack .b.cancel -side right -expand 1
3739
pack .b -side bottom -fill x -padx 10 -pady 10
3840

3941
bind . <Visibility> {focus -force .e}
40-
bind . <Key-Return> finish
41-
bind . <Key-Escape> {destroy .}
42-
bind . <Destroy> {exit $rc}
42+
bind . <Key-Return> [list .b.ok invoke]
43+
bind . <Key-Escape> [list .b.cancel invoke]
44+
bind . <Destroy> {set rc $rc}
45+
46+
proc cancel {} {
47+
set ::rc 255
48+
}
4349

4450
proc finish {} {
4551
if {$::yesno} {
@@ -50,10 +56,11 @@ proc finish {} {
5056
}
5157
}
5258

53-
set ::rc 0
5459
puts $::answer
55-
destroy .
60+
set ::rc 0
5661
}
5762

5863
wm title . "OpenSSH"
5964
tk::PlaceWindow .
65+
vwait rc
66+
exit $rc

git-gui/git-gui.sh

+28-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
exec wish "$argv0" -- "$@"
1111

1212
set appvers {@@GITGUI_VERSION@@}
13-
set copyright [encoding convertfrom utf-8 {
14-
Copyright © 2006, 2007 Shawn Pearce, et. al.
13+
set copyright [string map [list (c) \u00a9] {
14+
Copyright (c) 2006-2010 Shawn Pearce, et. al.
1515

1616
This program is free software; you can redistribute it and/or modify
1717
it under the terms of the GNU General Public License as published by
@@ -128,6 +128,7 @@ set _githtmldir {}
128128
set _reponame {}
129129
set _iscygwin {}
130130
set _search_path {}
131+
set _shellpath {@@SHELL_PATH@@}
131132

132133
set _trace [lsearch -exact $argv --trace]
133134
if {$_trace >= 0} {
@@ -137,6 +138,18 @@ if {$_trace >= 0} {
137138
set _trace 0
138139
}
139140

141+
proc shellpath {} {
142+
global _shellpath env
143+
if {[string match @@* $_shellpath]} {
144+
if {[info exists env(SHELL)]} {
145+
return $env(SHELL)
146+
} else {
147+
return /bin/sh
148+
}
149+
}
150+
return $_shellpath
151+
}
152+
140153
proc appname {} {
141154
global _appname
142155
return $_appname
@@ -2845,7 +2858,13 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
28452858
28462859
set subcommand_args {}
28472860
proc usage {} {
2848-
puts stderr "usage: $::argv0 $::subcommand $::subcommand_args"
2861+
set s "usage: $::argv0 $::subcommand $::subcommand_args"
2862+
if {[tk windowingsystem] eq "win32"} {
2863+
wm withdraw .
2864+
tk_messageBox -icon info -title "Usage" -message $s
2865+
} else {
2866+
puts stderr $s
2867+
}
28492868
exit 1
28502869
}
28512870
@@ -2938,7 +2957,12 @@ blame {
29382957
}
29392958
blame {
29402959
if {$head eq {} && ![file exists $path]} {
2941-
puts stderr [mc "fatal: cannot stat path %s: No such file or directory" $path]
2960+
catch {wm withdraw .}
2961+
tk_messageBox \
2962+
-icon error \
2963+
-type ok \
2964+
-title [mc "git-gui: fatal error"] \
2965+
-message [mc "fatal: cannot stat path %s: No such file or directory" $path]
29422966
exit 1
29432967
}
29442968
blame::new $head $path $jump_spec

git-gui/lib/blame.tcl

+8-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,14 @@ method _load {jump} {
460460
}
461461
if {$commit eq {}} {
462462
if {$do_textconv ne 0} {
463-
set fd [open |[list $textconv $path] r]
463+
# Run textconv with sh -c "..." to allow it to
464+
# contain command + arguments. On windows, just
465+
# call the filter command.
466+
if {![file executable [shellpath]]} {
467+
set fd [open |[linsert $textconv end $path] r]
468+
} else {
469+
set fd [open |[list [shellpath] -c "$textconv \"\$0\"" $path] r]
470+
}
464471
} else {
465472
set fd [open $path r]
466473
}

0 commit comments

Comments
 (0)