diff options
author | Pat Thoyts <patthoyts@users.sourceforge.net> | 2016-10-20 11:06:28 +0100 |
---|---|---|
committer | Pat Thoyts <patthoyts@users.sourceforge.net> | 2016-10-20 11:06:28 +0100 |
commit | be44aee7ab4aee57696b2cc5e5116ce54a023203 (patch) | |
tree | 87bbfef57090228b022ba06e56fd4b0f6a8bd3e1 /git-gui.sh | |
parent | Merge branch 'dr/ru' into pu (diff) | |
parent | git-gui: handle the encoding of Git's output correctly (diff) | |
download | tgif-be44aee7ab4aee57696b2cc5e5116ce54a023203.tar.xz |
Merge branch 'kb/unicode' into pu
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-x | git-gui.sh | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/git-gui.sh b/git-gui.sh index f9b323abff..5bc21b878d 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -534,28 +534,10 @@ proc _lappend_nice {cmd_var} { } proc git {args} { - set opt [list] - - while {1} { - switch -- [lindex $args 0] { - --nice { - _lappend_nice opt - } - - default { - break - } - - } - - set args [lrange $args 1 end] - } - - set cmdp [_git_cmd [lindex $args 0]] - set args [lrange $args 1 end] - - _trace_exec [concat $opt $cmdp $args] - set result [eval exec $opt $cmdp $args] + set fd [eval [list git_read] $args] + fconfigure $fd -translation binary -encoding utf-8 + set result [string trimright [read $fd] "\n"] + close $fd if {$::_trace} { puts stderr "< $result" } @@ -1111,7 +1093,7 @@ git-version proc _parse_config {arr_name args} { [list git_read config] \ $args \ [list --null --list]] - fconfigure $fd_rc -translation binary + fconfigure $fd_rc -translation binary -encoding utf-8 set buf [read $fd_rc] close $fd_rc } @@ -1691,7 +1673,7 @@ proc read_diff_index {fd after} { set i [split [string range $buf_rdi $c [expr {$z1 - 2}]] { }] set p [string range $buf_rdi $z1 [expr {$z2 - 1}]] merge_state \ - [encoding convertfrom $p] \ + [encoding convertfrom utf-8 $p] \ [lindex $i 4]? \ [list [lindex $i 0] [lindex $i 2]] \ [list] @@ -1724,7 +1706,7 @@ proc read_diff_files {fd after} { set i [split [string range $buf_rdf $c [expr {$z1 - 2}]] { }] set p [string range $buf_rdf $z1 [expr {$z2 - 1}]] merge_state \ - [encoding convertfrom $p] \ + [encoding convertfrom utf-8 $p] \ ?[lindex $i 4] \ [list] \ [list [lindex $i 0] [lindex $i 2]] @@ -1747,7 +1729,7 @@ proc read_ls_others {fd after} { set pck [split $buf_rlo "\0"] set buf_rlo [lindex $pck end] foreach p [lrange $pck 0 end-1] { - set p [encoding convertfrom $p] + set p [encoding convertfrom utf-8 $p] if {[string index $p end] eq {/}} { set p [string range $p 0 end-1] } |