Skip to content

Commit 43a1473

Browse files
committed
Merge 'unicode' into HEAD
2 parents 7cb4d70 + dc595c0 commit 43a1473

File tree

4 files changed

+20
-37
lines changed

4 files changed

+20
-37
lines changed

git-gui/git-gui.sh

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -526,28 +526,10 @@ proc _lappend_nice {cmd_var} {
526526
}
527527
528528
proc git {args} {
529-
set opt [list]
530-
531-
while {1} {
532-
switch -- [lindex $args 0] {
533-
--nice {
534-
_lappend_nice opt
535-
}
536-
537-
default {
538-
break
539-
}
540-
541-
}
542-
543-
set args [lrange $args 1 end]
544-
}
545-
546-
set cmdp [_git_cmd [lindex $args 0]]
547-
set args [lrange $args 1 end]
548-
549-
_trace_exec [concat $opt $cmdp $args]
550-
set result [eval exec $opt $cmdp $args]
529+
set fd [eval [list git_read] $args]
530+
fconfigure $fd -translation binary -encoding utf-8
531+
set result [string trimright [read $fd] "\n"]
532+
close $fd
551533
if {$::_trace} {
552534
puts stderr "< $result"
553535
}
@@ -1104,7 +1086,7 @@ git-version proc _parse_config {arr_name args} {
11041086
[list git_read config] \
11051087
$args \
11061088
[list --null --list]]
1107-
fconfigure $fd_rc -translation binary
1089+
fconfigure $fd_rc -translation binary -encoding utf-8
11081090
set buf [read $fd_rc]
11091091
close $fd_rc
11101092
}
@@ -1682,7 +1664,7 @@ proc read_diff_index {fd after} {
16821664
set i [split [string range $buf_rdi $c [expr {$z1 - 2}]] { }]
16831665
set p [string range $buf_rdi $z1 [expr {$z2 - 1}]]
16841666
merge_state \
1685-
[encoding convertfrom $p] \
1667+
[encoding convertfrom utf-8 $p] \
16861668
[lindex $i 4]? \
16871669
[list [lindex $i 0] [lindex $i 2]] \
16881670
[list]
@@ -1715,7 +1697,7 @@ proc read_diff_files {fd after} {
17151697
set i [split [string range $buf_rdf $c [expr {$z1 - 2}]] { }]
17161698
set p [string range $buf_rdf $z1 [expr {$z2 - 1}]]
17171699
merge_state \
1718-
[encoding convertfrom $p] \
1700+
[encoding convertfrom utf-8 $p] \
17191701
?[lindex $i 4] \
17201702
[list] \
17211703
[list [lindex $i 0] [lindex $i 2]]
@@ -1738,7 +1720,7 @@ proc read_ls_others {fd after} {
17381720
set pck [split $buf_rlo "\0"]
17391721
set buf_rlo [lindex $pck end]
17401722
foreach p [lrange $pck 0 end-1] {
1741-
set p [encoding convertfrom $p]
1723+
set p [encoding convertfrom utf-8 $p]
17421724
if {[string index $p end] eq {/}} {
17431725
set p [string range $p 0 end-1]
17441726
}

git-gui/lib/browser.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ method _ls {tree_id {name {}}} {
197197
$w conf -state disabled
198198

199199
set fd [git_read ls-tree -z $tree_id]
200-
fconfigure $fd -blocking 0 -translation binary -encoding binary
200+
fconfigure $fd -blocking 0 -translation binary -encoding utf-8
201201
fileevent $fd readable [cb _read $fd]
202202
}
203203

git-gui/lib/index.tcl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ proc write_update_indexinfo {fd pathList totalCnt batch after} {
115115
set info [lindex $s 2]
116116
if {$info eq {}} continue
117117

118-
puts -nonewline $fd "$info\t[encoding convertto $path]\0"
118+
puts -nonewline $fd "$info\t[encoding convertto utf-8 $path]\0"
119119
display_file $path $new
120120
}
121121

@@ -186,7 +186,7 @@ proc write_update_index {fd pathList totalCnt batch after} {
186186
?M {set new M_}
187187
?? {continue}
188188
}
189-
puts -nonewline $fd "[encoding convertto $path]\0"
189+
puts -nonewline $fd "[encoding convertto utf-8 $path]\0"
190190
display_file $path $new
191191
}
192192

@@ -247,7 +247,7 @@ proc write_checkout_index {fd pathList totalCnt batch after} {
247247
?M -
248248
?T -
249249
?D {
250-
puts -nonewline $fd "[encoding convertto $path]\0"
250+
puts -nonewline $fd "[encoding convertto utf-8 $path]\0"
251251
display_file $path ?_
252252
}
253253
}

gitk-git/gitk

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7498,7 +7498,7 @@ proc gettreeline {gtf id} {
74987498
if {[string index $fname 0] eq "\""} {
74997499
set fname [lindex $fname 0]
75007500
}
7501-
set fname [encoding convertfrom $fname]
7501+
set fname [encoding convertfrom utf-8 $fname]
75027502
lappend treefilelist($id) $fname
75037503
}
75047504
if {![eof $gtf]} {
@@ -7760,7 +7760,7 @@ proc gettreediffline {gdtf ids} {
77607760
if {[string index $file 0] eq "\""} {
77617761
set file [lindex $file 0]
77627762
}
7763-
set file [encoding convertfrom $file]
7763+
set file [encoding convertfrom utf-8 $file]
77647764
if {$file ne [lindex $treediff end]} {
77657765
lappend treediff $file
77667766
lappend sublist $file
@@ -7905,7 +7905,7 @@ proc makediffhdr {fname ids} {
79057905
global ctext curdiffstart treediffs diffencoding
79067906
global ctext_file_names jump_to_here targetline diffline
79077907

7908-
set fname [encoding convertfrom $fname]
7908+
set fname [encoding convertfrom utf-8 $fname]
79097909
set diffencoding [get_path_encoding $fname]
79107910
set i [lsearch -exact $treediffs($ids) $fname]
79117911
if {$i >= 0} {
@@ -7962,7 +7962,7 @@ proc parseblobdiffline {ids line} {
79627962

79637963
if {![string compare -length 5 "diff " $line]} {
79647964
if {![regexp {^diff (--cc|--git) } $line m type]} {
7965-
set line [encoding convertfrom $line]
7965+
set line [encoding convertfrom utf-8 $line]
79667966
$ctext insert end "$line\n" hunksep
79677967
continue
79687968
}
@@ -8009,7 +8009,7 @@ proc parseblobdiffline {ids line} {
80098009
makediffhdr $fname $ids
80108010

80118011
} elseif {![string compare -length 16 "* Unmerged path " $line]} {
8012-
set fname [encoding convertfrom [string range $line 16 end]]
8012+
set fname [encoding convertfrom utf-8 [string range $line 16 end]]
80138013
$ctext insert end "\n"
80148014
set curdiffstart [$ctext index "end - 1c"]
80158015
lappend ctext_file_names $fname
@@ -8064,7 +8064,7 @@ proc parseblobdiffline {ids line} {
80648064
if {[string index $fname 0] eq "\""} {
80658065
set fname [lindex $fname 0]
80668066
}
8067-
set fname [encoding convertfrom $fname]
8067+
set fname [encoding convertfrom utf-8 $fname]
80688068
set i [lsearch -exact $treediffs($ids) $fname]
80698069
if {$i >= 0} {
80708070
setinlist difffilestart $i $curdiffstart
@@ -8083,6 +8083,7 @@ proc parseblobdiffline {ids line} {
80838083
set diffinhdr 0
80848084
return
80858085
}
8086+
set line [encoding convertfrom utf-8 $line]
80868087
$ctext insert end "$line\n" filesep
80878088

80888089
} else {
@@ -11893,7 +11894,7 @@ proc cache_gitattr {attr pathlist} {
1189311894
foreach row [split $rlist "\n"] {
1189411895
if {[regexp "(.*): $attr: (.*)" $row m path value]} {
1189511896
if {[string index $path 0] eq "\""} {
11896-
set path [encoding convertfrom [lindex $path 0]]
11897+
set path [encoding convertfrom utf-8 [lindex $path 0]]
1189711898
}
1189811899
set path_attr_cache($attr,$path) $value
1189911900
}

0 commit comments

Comments
 (0)