Skip to content

Commit a57f420

Browse files
committed
Merge 'unicode' into HEAD
2 parents 840c875 + e7fd4cc commit a57f420

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
@@ -530,28 +530,10 @@ proc _lappend_nice {cmd_var} {
530530
}
531531
532532
proc git {args} {
533-
set opt [list]
534-
535-
while {1} {
536-
switch -- [lindex $args 0] {
537-
--nice {
538-
_lappend_nice opt
539-
}
540-
541-
default {
542-
break
543-
}
544-
545-
}
546-
547-
set args [lrange $args 1 end]
548-
}
549-
550-
set cmdp [_git_cmd [lindex $args 0]]
551-
set args [lrange $args 1 end]
552-
553-
_trace_exec [concat $opt $cmdp $args]
554-
set result [eval exec $opt $cmdp $args]
533+
set fd [eval [list git_read] $args]
534+
fconfigure $fd -translation binary -encoding utf-8
535+
set result [string trimright [read $fd] "\n"]
536+
close $fd
555537
if {$::_trace} {
556538
puts stderr "< $result"
557539
}
@@ -1107,7 +1089,7 @@ git-version proc _parse_config {arr_name args} {
11071089
[list git_read config] \
11081090
$args \
11091091
[list --null --list]]
1110-
fconfigure $fd_rc -translation binary
1092+
fconfigure $fd_rc -translation binary -encoding utf-8
11111093
set buf [read $fd_rc]
11121094
close $fd_rc
11131095
}
@@ -1685,7 +1667,7 @@ proc read_diff_index {fd after} {
16851667
set i [split [string range $buf_rdi $c [expr {$z1 - 2}]] { }]
16861668
set p [string range $buf_rdi $z1 [expr {$z2 - 1}]]
16871669
merge_state \
1688-
[encoding convertfrom $p] \
1670+
[encoding convertfrom utf-8 $p] \
16891671
[lindex $i 4]? \
16901672
[list [lindex $i 0] [lindex $i 2]] \
16911673
[list]
@@ -1718,7 +1700,7 @@ proc read_diff_files {fd after} {
17181700
set i [split [string range $buf_rdf $c [expr {$z1 - 2}]] { }]
17191701
set p [string range $buf_rdf $z1 [expr {$z2 - 1}]]
17201702
merge_state \
1721-
[encoding convertfrom $p] \
1703+
[encoding convertfrom utf-8 $p] \
17221704
?[lindex $i 4] \
17231705
[list] \
17241706
[list [lindex $i 0] [lindex $i 2]]
@@ -1741,7 +1723,7 @@ proc read_ls_others {fd after} {
17411723
set pck [split $buf_rlo "\0"]
17421724
set buf_rlo [lindex $pck end]
17431725
foreach p [lrange $pck 0 end-1] {
1744-
set p [encoding convertfrom $p]
1726+
set p [encoding convertfrom utf-8 $p]
17451727
if {[string index $p end] eq {/}} {
17461728
set p [string range $p 0 end-1]
17471729
}

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
@@ -7629,7 +7629,7 @@ proc gettreeline {gtf id} {
76297629
if {[string index $fname 0] eq "\""} {
76307630
set fname [lindex $fname 0]
76317631
}
7632-
set fname [encoding convertfrom $fname]
7632+
set fname [encoding convertfrom utf-8 $fname]
76337633
lappend treefilelist($id) $fname
76347634
}
76357635
if {![eof $gtf]} {
@@ -7891,7 +7891,7 @@ proc gettreediffline {gdtf ids} {
78917891
if {[string index $file 0] eq "\""} {
78927892
set file [lindex $file 0]
78937893
}
7894-
set file [encoding convertfrom $file]
7894+
set file [encoding convertfrom utf-8 $file]
78957895
if {$file ne [lindex $treediff end]} {
78967896
lappend treediff $file
78977897
lappend sublist $file
@@ -8036,7 +8036,7 @@ proc makediffhdr {fname ids} {
80368036
global ctext curdiffstart treediffs diffencoding
80378037
global ctext_file_names jump_to_here targetline diffline
80388038

8039-
set fname [encoding convertfrom $fname]
8039+
set fname [encoding convertfrom utf-8 $fname]
80408040
set diffencoding [get_path_encoding $fname]
80418041
set i [lsearch -exact $treediffs($ids) $fname]
80428042
if {$i >= 0} {
@@ -8093,7 +8093,7 @@ proc parseblobdiffline {ids line} {
80938093

80948094
if {![string compare -length 5 "diff " $line]} {
80958095
if {![regexp {^diff (--cc|--git) } $line m type]} {
8096-
set line [encoding convertfrom $line]
8096+
set line [encoding convertfrom utf-8 $line]
80978097
$ctext insert end "$line\n" hunksep
80988098
continue
80998099
}
@@ -8140,7 +8140,7 @@ proc parseblobdiffline {ids line} {
81408140
makediffhdr $fname $ids
81418141

81428142
} elseif {![string compare -length 16 "* Unmerged path " $line]} {
8143-
set fname [encoding convertfrom [string range $line 16 end]]
8143+
set fname [encoding convertfrom utf-8 [string range $line 16 end]]
81448144
$ctext insert end "\n"
81458145
set curdiffstart [$ctext index "end - 1c"]
81468146
lappend ctext_file_names $fname
@@ -8195,7 +8195,7 @@ proc parseblobdiffline {ids line} {
81958195
if {[string index $fname 0] eq "\""} {
81968196
set fname [lindex $fname 0]
81978197
}
8198-
set fname [encoding convertfrom $fname]
8198+
set fname [encoding convertfrom utf-8 $fname]
81998199
set i [lsearch -exact $treediffs($ids) $fname]
82008200
if {$i >= 0} {
82018201
setinlist difffilestart $i $curdiffstart
@@ -8214,6 +8214,7 @@ proc parseblobdiffline {ids line} {
82148214
set diffinhdr 0
82158215
return
82168216
}
8217+
set line [encoding convertfrom utf-8 $line]
82178218
$ctext insert end "$line\n" filesep
82188219

82198220
} else {
@@ -12047,7 +12048,7 @@ proc cache_gitattr {attr pathlist} {
1204712048
foreach row [split $rlist "\n"] {
1204812049
if {[regexp "(.*): $attr: (.*)" $row m path value]} {
1204912050
if {[string index $path 0] eq "\""} {
12050-
set path [encoding convertfrom [lindex $path 0]]
12051+
set path [encoding convertfrom utf-8 [lindex $path 0]]
1205112052
}
1205212053
set path_attr_cache($attr,$path) $value
1205312054
}

0 commit comments

Comments
 (0)