git-gui: Correctly handle spaces in filepaths.
Anytime are about to open a pipe on what may be user data we need to make sure the value is escaped correctly into a Tcl list, so that the executed subprocess will receive the right arguments. For the most part we were already doing this correctly, but a handful of locations did not. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Jan 29, 2007 at 03:09 UTC
8f6c07b902b297329e63799d5332758530ec4d99
1 file changed
+4
-2
git-gui.sh
+4
-2
@@ -3087,7 +3087,8 @@ proc ls_tree {w tree_id name} {
3087
lappend browser_stack($w) [list $tree_id $name]
3088
$w conf -state disabled
3089
3090
- set fd [open "| git ls-tree -z $tree_id" r]
3090
+ set cmd [list git ls-tree -z $tree_id]
3091
+ set fd [open "| $cmd" r]
3092
fconfigure $fd -blocking 0 -translation binary -encoding binary
3093
fileevent $fd readable [list read_ls_tree $fd $w]
3094
}
@@ -3247,7 +3248,8 @@ proc show_blame {commit path} {
3248
wm title $w "[appname] ([reponame]): File Viewer"
3249
3250
set blame_data($w,total_lines) 0
3250
- set fd [open "| git cat-file blob $commit:$path" r]
3251
+ set cmd [list git cat-file blob "$commit:$path"]
3252
+ set fd [open "| $cmd" r]
3253
fconfigure $fd -blocking 0 -translation lf -encoding binary
3254
fileevent $fd readable [list read_blame_catfile $fd $w $commit $path \
3255
$texts $w.out.linenumber $w.out.file]