Skip to content

Commit 1e72512

Browse files
committed
gitk: Fixing file name encoding issues
Signed-off-by: Kazuhiro Kato <[email protected]>
1 parent 4a6cc6a commit 1e72512

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

gitk

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ proc parseviewrevs {view revs} {
493493
proc escape_filter_paths {paths} {
494494
set escaped [list]
495495
foreach path $paths {
496-
lappend escaped [string map {\\ \\\\ "\ " "\\\ "} $path]
496+
lappend escaped [string map {\\ "/" } $path]
497497
}
498498
return $escaped
499499
}
@@ -558,9 +558,8 @@ proc start_rev_list {view} {
558558
559559
if {[catch {
560560
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
561-
--parents --boundary $args --stdin \
562-
"<<[join [concat $revs "--" \
563-
[escape_filter_paths $files]] "\\n"]"] r]
561+
--parents --boundary $args \
562+
[list $revs "--" [escape_filter_paths $files]]] r]
564563
} err]} {
565564
error_popup "[mc "Error executing git log:"] $err"
566565
return 0
@@ -712,10 +711,8 @@ proc updatecommits {} {
712711
}
713712
if {[catch {
714713
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
715-
--parents --boundary $args --stdin \
716-
"<<[join [concat $revs "--" \
717-
[escape_filter_paths \
718-
$vfilelimit($view)]] "\\n"]"] r]
714+
--parents --boundary $args \
715+
[list $revs "--" [escape_filter_paths $vfilelimit($view)]] r]]
719716
} err]} {
720717
error_popup "[mc "Error executing git log:"] $err"
721718
return
@@ -12742,11 +12739,17 @@ foreach arg $argv {
1274212739
if {$selecthead eq "HEAD"} {
1274312740
set selecthead {}
1274412741
}
12742+
proc capture_enc {cmd enc} {
12743+
set f [open "| $cmd" r]
12744+
fconfigure $f -encoding $enc
12745+
read $f
12746+
}
1274512747
1274612748
if {$i >= [llength $argv] && $revtreeargs ne {}} {
1274712749
# no -- on command line, but some arguments (other than --argscmd)
1274812750
if {[catch {
12749-
set f [eval exec git rev-parse --no-revs --no-flags $revtreeargs]
12751+
set f [capture_enc "git rev-parse --no-revs --no-flags $revtreeargs" utf-8]
12752+
set f [string trimright "$f" "\n"]
1275012753
set cmdline_files [split $f "\n"]
1275112754
set n [llength $cmdline_files]
1275212755
set revtreeargs [lrange $revtreeargs 0 end-$n]

0 commit comments

Comments
 (0)