git-gui: Honor system encoding for filenames.
Since git operates on filenames using the operating system encoding any data we are receiving from it by way of a pipe, or sending to it by way of a pipe must be formatted in that encoding. This should be the same as the Tcl system encoding, as its the encoding that applications should be using to converse with the operating system. Sadly this does not fix the gitweb/test file in git.git on Macs; that's due to something really broken happening in the filesystem. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Jan 23, 2007 at 04:07 UTC
51a989ba5a4d1299d08ddad19c6a45485bdb7dd8
1 file changed
+14
-9
git-gui.sh
+14
-9
@@ -410,9 +410,9 @@ proc rescan_stage2 {fd after} {
410
set fd_df [open "| git diff-files -z" r]
411
set fd_lo [open $ls_others r]
412
413
- fconfigure $fd_di -blocking 0 -translation binary
414
- fconfigure $fd_df -blocking 0 -translation binary
415
- fconfigure $fd_lo -blocking 0 -translation binary
413
+ fconfigure $fd_di -blocking 0 -translation binary -encoding binary
414
+ fconfigure $fd_df -blocking 0 -translation binary -encoding binary
415
+ fconfigure $fd_lo -blocking 0 -translation binary -encoding binary
416
fileevent $fd_di readable [list read_diff_index $fd_di $after]
417
fileevent $fd_df readable [list read_diff_files $fd_df $after]
418
fileevent $fd_lo readable [list read_ls_others $fd_lo $after]
@@ -450,8 +450,9 @@ proc read_diff_index {fd after} {
450
451
incr c
452
set i [split [string range $buf_rdi $c [expr {$z1 - 2}]] { }]
453
+ set p [string range $buf_rdi $z1 [expr {$z2 - 1}]]
454
merge_state \
454
- [string range $buf_rdi $z1 [expr {$z2 - 1}]] \
455
+ [encoding convertfrom $p] \
456
[lindex $i 4]? \
457
[list [lindex $i 0] [lindex $i 2]] \
458
[list]
@@ -482,8 +483,9 @@ proc read_diff_files {fd after} {
483
484
incr c
485
set i [split [string range $buf_rdf $c [expr {$z1 - 2}]] { }]
486
+ set p [string range $buf_rdf $z1 [expr {$z2 - 1}]]
487
merge_state \
486
- [string range $buf_rdf $z1 [expr {$z2 - 1}]] \
488
+ [encoding convertfrom $p] \
489
?[lindex $i 4] \
490
[list] \
491
[list [lindex $i 0] [lindex $i 2]]
@@ -506,7 +508,7 @@ proc read_ls_others {fd after} {
508
set pck [split $buf_rlo "\0"]
509
set buf_rlo [lindex $pck end]
510
foreach p [lrange $pck 0 end-1] {
509
- merge_state $p ?O
511
+ merge_state [encoding convertfrom $p] ?O
512
}
513
rescan_done $fd buf_rlo $after
514
}
@@ -1459,6 +1461,7 @@ proc update_indexinfo {msg pathList after} {
1461
-blocking 0 \
1462
-buffering full \
1463
-buffersize 512 \
1464
+ -encoding binary \
1465
-translation binary
1466
fileevent $fd writable [list \
1467
write_update_indexinfo \
@@ -1499,7 +1502,7 @@ proc write_update_indexinfo {fd pathList totalCnt batch msg after} {
1502
set info [lindex $s 2]
1503
if {$info eq {}} continue
1504
1502
- puts -nonewline $fd "$info\t$path\0"
1505
+ puts -nonewline $fd "$info\t[encoding convertto $path]\0"
1506
display_file $path $new
1507
}
1508
@@ -1531,6 +1534,7 @@ proc update_index {msg pathList after} {
1534
-blocking 0 \
1535
-buffering full \
1536
-buffersize 512 \
1537
+ -encoding binary \
1538
-translation binary
1539
fileevent $fd writable [list \
1540
write_update_index \
@@ -1575,7 +1579,7 @@ proc write_update_index {fd pathList totalCnt batch msg after} {
1579
?M {set new M_}
1580
?? {continue}
1581
}
1578
- puts -nonewline $fd "$path\0"
1582
+ puts -nonewline $fd "[encoding convertto $path]\0"
1583
display_file $path $new
1584
}
1585
@@ -1613,6 +1617,7 @@ proc checkout_index {msg pathList after} {
1617
-blocking 0 \
1618
-buffering full \
1619
-buffersize 512 \
1620
+ -encoding binary \
1621
-translation binary
1622
fileevent $fd writable [list \
1623
write_checkout_index \
@@ -1645,7 +1650,7 @@ proc write_checkout_index {fd pathList totalCnt batch msg after} {
1650
U? {continue}
1651
?M -
1652
?D {
1648
- puts -nonewline $fd "$path\0"
1653
+ puts -nonewline $fd "[encoding convertto $path]\0"
1654
display_file $path ?_
1655
}
1656
}