]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: do not mix -translation binary and -encoding
authorMark Levedahl <mlevedahl@gmail.com>
Wed, 21 May 2025 23:18:46 +0000 (19:18 -0400)
committerMark Levedahl <mlevedahl@gmail.com>
Tue, 22 Jul 2025 16:32:58 +0000 (12:32 -0400)
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 <mlevedahl@gmail.com>
git-gui.sh
lib/branch.tcl
lib/browser.tcl
lib/choose_rev.tcl

index 07781e7d908f80549916b78a903052110b9391b7..63c2f48f91ac126120e9f99225c7053534b532b4 100755 (executable)
@@ -592,7 +592,7 @@ proc git {args} {
 
 proc git_redir {cmd redir} {
        set fd [git_read $cmd $redir]
-       fconfigure $fd -translation binary -encoding utf-8
+       fconfigure $fd -encoding utf-8
        set result [string trimright [read $fd] "\n"]
        close $fd
        if {$::_trace} {
@@ -1004,7 +1004,7 @@ proc _parse_config {arr_name args} {
                        [concat config \
                        $args \
                        --null --list]]
-               fconfigure $fd_rc -translation binary -encoding utf-8
+               fconfigure $fd_rc -encoding utf-8
                set buf [read $fd_rc]
                close $fd_rc
        }
index 39e0f2dc9864e0d3902840e9c26ab71f8aaf2a81..97c9ec1c00f741f4142135a583a5bc8cb755f0c5 100644 (file)
@@ -8,7 +8,7 @@ proc load_all_heads {} {
        set rh_len [expr {[string length $rh] + 1}]
        set all_heads [list]
        set fd [git_read [list for-each-ref --format=%(refname) $rh]]
-       fconfigure $fd -translation binary -encoding utf-8
+       fconfigure $fd -encoding utf-8
        while {[gets $fd line] > 0} {
                if {!$some_heads_tracking || ![is_tracking_branch $line]} {
                        lappend all_heads [string range $line $rh_len end]
@@ -25,7 +25,7 @@ proc load_all_tags {} {
                --sort=-taggerdate \
                --format=%(refname) \
                refs/tags]]
-       fconfigure $fd -translation binary -encoding utf-8
+       fconfigure $fd -encoding utf-8
        while {[gets $fd line] > 0} {
                if {![regsub ^refs/tags/ $line {} name]} continue
                lappend all_tags $name
index f53eb952cf3ff4711025921e5b3b45ff9945aed1..fe72de025e65da5da7d61e07280b8afef2cff4c0 100644 (file)
@@ -195,7 +195,7 @@ method _ls {tree_id {name {}}} {
        $w conf -state disabled
 
        set fd [git_read [list ls-tree -z $tree_id]]
-       fconfigure $fd -blocking 0 -translation binary -encoding utf-8
+       fconfigure $fd -blocking 0 -encoding utf-8
        fileevent $fd readable [cb _read $fd]
 }
 
index 7a9e3c83bb906921eabb6762a78e31856d4fcfdc..4cf6cebac433b14d303aeaa556298455ae267fb7 100644 (file)
@@ -570,7 +570,7 @@ method _reflog_last {name} {
        set last {}
        if {[catch {set last [file mtime [gitdir $name]]}]
        && ![catch {set g [safe_open_file [gitdir logs $name] r]}]} {
-               fconfigure $g -translation binary
+               fconfigure $g -encoding iso8859-1
                while {[gets $g line] >= 0} {
                        if {[regexp {> ([1-9][0-9]*) } $line line when]} {
                                set last $when