Skip to content

Commit 07714e2

Browse files
committed
git-gui: do not mix -translation binary and -encoding
git-gui has many instances of '-translation binary' and '-encoding $SOMETHING' on the same channel. As eofchar is always null given a prior commit, the net effect of having '-translation binary' in such configuration is only to change how text line endings are handled. For cases where the channel is opened to be consumed via gets, the eol translation is irrelevant because Tcl's gets is documented to recognize any of \n, \r, and \r\n as a line ending. So, keep only the '-encoding $SOMETHING' configuration in these cases, making the configuration more clear. Signed-off-by: Mark Levedahl <[email protected]>
1 parent 40f54f6 commit 07714e2

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

git-gui.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ proc git {args} {
592592

593593
proc git_redir {cmd redir} {
594594
set fd [git_read $cmd $redir]
595-
fconfigure $fd -translation binary -encoding utf-8
595+
fconfigure $fd -encoding utf-8
596596
set result [string trimright [read $fd] "\n"]
597597
close $fd
598598
if {$::_trace} {
@@ -1004,7 +1004,7 @@ proc _parse_config {arr_name args} {
10041004
[concat config \
10051005
$args \
10061006
--null --list]]
1007-
fconfigure $fd_rc -translation binary -encoding utf-8
1007+
fconfigure $fd_rc -encoding utf-8
10081008
set buf [read $fd_rc]
10091009
close $fd_rc
10101010
}

lib/branch.tcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ proc load_all_heads {} {
88
set rh_len [expr {[string length $rh] + 1}]
99
set all_heads [list]
1010
set fd [git_read [list for-each-ref --format=%(refname) $rh]]
11-
fconfigure $fd -translation binary -encoding utf-8
11+
fconfigure $fd -encoding utf-8
1212
while {[gets $fd line] > 0} {
1313
if {!$some_heads_tracking || ![is_tracking_branch $line]} {
1414
lappend all_heads [string range $line $rh_len end]
@@ -25,7 +25,7 @@ proc load_all_tags {} {
2525
--sort=-taggerdate \
2626
--format=%(refname) \
2727
refs/tags]]
28-
fconfigure $fd -translation binary -encoding utf-8
28+
fconfigure $fd -encoding utf-8
2929
while {[gets $fd line] > 0} {
3030
if {![regsub ^refs/tags/ $line {} name]} continue
3131
lappend all_tags $name

lib/browser.tcl

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

197197
set fd [git_read [list ls-tree -z $tree_id]]
198-
fconfigure $fd -blocking 0 -translation binary -encoding utf-8
198+
fconfigure $fd -blocking 0 -encoding utf-8
199199
fileevent $fd readable [cb _read $fd]
200200
}
201201

lib/choose_rev.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ method _reflog_last {name} {
570570
set last {}
571571
if {[catch {set last [file mtime [gitdir $name]]}]
572572
&& ![catch {set g [safe_open_file [gitdir logs $name] r]}]} {
573-
fconfigure $g -translation binary
573+
fconfigure $g -encoding iso8859-1
574574
while {[gets $g line] >= 0} {
575575
if {[regexp {> ([1-9][0-9]*) } $line line when]} {
576576
set last $when

0 commit comments

Comments
 (0)