Skip to content

Commit

Permalink
git-gui: use shell to launch textconv filter in "blame"
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthieu Moy authored and Pat Thoyts committed Aug 12, 2010
1 parent 7807777 commit 62f9a63
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ endif
$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-VARS
$(QUIET_GEN)rm -f $@ $@+ && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's|@@SHELL_PATH@@|$(SHELL_PATH_SQ)|' \
-e '1,30s|^ argv0=$$0| argv0=$(GITGUI_SCRIPT)|' \
-e '1,30s|^ exec wish | exec '\''$(TCLTK_PATH_SED)'\'' |' \
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
Expand Down
6 changes: 6 additions & 0 deletions git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ set _githtmldir {}
set _reponame {}
set _iscygwin {}
set _search_path {}
set _shellpath {@@SHELL_PATH@@}

set _trace [lsearch -exact $argv --trace]
if {$_trace >= 0} {
Expand All @@ -137,6 +138,11 @@ if {$_trace >= 0} {
set _trace 0
}

proc shellpath {} {
global _shellpath
return $_shellpath
}

proc appname {} {
global _appname
return $_appname
Expand Down
4 changes: 3 additions & 1 deletion lib/blame.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ method _load {jump} {
}
if {$commit eq {}} {
if {$do_textconv ne 0} {
set fd [open |[list $textconv $path] r]
# Run textconv with sh -c "..." to allow it to
# contain command + arguments.
set fd [open |[list [shellpath] -c "$textconv \"\$0\"" $path] r]
} else {
set fd [open $path r]
}
Expand Down

0 comments on commit 62f9a63

Please sign in to comment.