git-gui: handle textconv filter on Windows and in development
When developing/testing we run git-gui.sh directly and the makefile configured variables are not properly set. Configure the new shellpath accessor to handle this case. On Windows we may not find the shell so in this case revert to simply executing the filter command without the shell intermediate. Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Pat Thoyts committed
Aug 7, 2010 at 20:32 UTC
d5257fb3c1decc1eff296a0ae2afbcaee28d0f2c
2 files changed
+15
-3
git-gui.sh
+8
-1
@@ -139,7 +139,14 @@ if {$_trace >= 0} {
139
}
140
141
proc shellpath {} {
142
- global _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
lib/blame.tcl
+7
-2
@@ -461,8 +461,13 @@ method _load {jump} {
461
if {$commit eq {}} {
462
if {$do_textconv ne 0} {
463
# Run textconv with sh -c "..." to allow it to
464
- # contain command + arguments.
465
- set fd [open |[list [shellpath] -c "$textconv \"\$0\"" $path] r]
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
+ }
471
} else {
472
set fd [open $path r]
473
}