@matheusbsbs / matheus-bagliano / commits / 62f9a632c8
Fork 0

git-gui: use shell to launch textconv filter in "blame"

The textconv filters may include multiple arguments and may make use of unix shell features. To maintain compatibility with 'git blame' ensure these commands are passed through bash. Reported-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Matthieu Moy committed Aug 5, 2010 at 12:05 UTC 62f9a632c819bd53a5b7dbe40409ab086a4bce10
3 files changed +10 -1
Makefile
+1
@@ -215,6 +215,7 @@ endif
215 $(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-VARS
216 $(QUIET_GEN)rm -f $@ $@+ && \
217 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
218 + -e 's|@@SHELL_PATH@@|$(SHELL_PATH_SQ)|' \
219 -e '1,30s|^ argv0=$$0| argv0=$(GITGUI_SCRIPT)|' \
220 -e '1,30s|^ exec wish | exec '\''$(TCLTK_PATH_SED)'\'' |' \
221 -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
git-gui.sh
+6
@@ -128,6 +128,7 @@ set _githtmldir {}
128 set _reponame {}
129 set _iscygwin {}
130 set _search_path {}
131 +set _shellpath {@@SHELL_PATH@@}
132
133 set _trace [lsearch -exact $argv --trace]
134 if {$_trace >= 0} {
@@ -137,6 +138,11 @@ if {$_trace >= 0} {
138 set _trace 0
139 }
140
141 +proc shellpath {} {
142 + global _shellpath
143 + return $_shellpath
144 +}
145 +
146 proc appname {} {
147 global _appname
148 return $_appname
lib/blame.tcl
+3 -1
@@ -460,7 +460,9 @@ method _load {jump} {
460 }
461 if {$commit eq {}} {
462 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.
465 + set fd [open |[list [shellpath] -c "$textconv \"\$0\"" $path] r]
466 } else {
467 set fd [open $path r]
468 }