{"thread":{"id":"16613","subject":"[PATCH (GIT-GUI FIX)] git-gui: Fix commit encoding handling.","startedAt":"2008-12-06T17:24:35Z","lastAt":"2008-12-06T17:24:35Z","messageCount":1,"participants":["Alexander Gavrilov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"97269","messageId":"200812062024.35986.angavrilov@gmail.com","threadId":"16613","inReplyTo":null,"subject":"[PATCH (GIT-GUI FIX)] git-gui: Fix commit encoding handling.","fromName":"Alexander Gavrilov","fromEmail":"angavrilov@gmail.com","sentAt":"2008-12-06T17:24:35Z","receivedAt":"2008-12-06T17:24:35Z","isPatch":true,"sender":{"key":"angavrilov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42666?v=4"},"body":"Commits without an encoding header are supposed to\nbe encoded in utf8. While this apparently hasn't always\nbeen the case, currently it is the active convention, so\nit is better to follow it; otherwise people who have to\nuse commitEncoding on their machines are unable to read\nutf-8 commits made by others.\n\nI also think that it is preferrable to display the warning\nabout an unsupported value of commitEncoding more prominently,\nbecause this condition may lead to surprising behavior and,\neventually, to loss of data.\n\nSigned-off-by: Alexander Gavrilov <angavrilov@gmail.com>\n---\n lib/blame.tcl  |    5 ++---\n lib/commit.tcl |    7 +++----\n 2 files changed, 5 insertions(+), 7 deletions(-)\n\ndiff --git a/lib/blame.tcl b/lib/blame.tcl\nindex c1cd7f3..1f3b08f 100644\n--- a/lib/blame.tcl\n+++ b/lib/blame.tcl\n@@ -940,9 +940,8 @@ method _showcommit {cur_w lno} {\n \t\t\tcatch {\n \t\t\t\tset fd [git_read cat-file commit $cmit]\n \t\t\t\tfconfigure $fd -encoding binary -translation lf\n-\t\t\t\tif {[catch {set enc $repo_config(i18n.commitencoding)}]} {\n-\t\t\t\t\tset enc utf-8\n-\t\t\t\t}\n+\t\t\t\t# By default commits are assumed to be in utf-8\n+\t\t\t\tset enc utf-8\n \t\t\t\twhile {[gets $fd line] > 0} {\n \t\t\t\t\tif {[string match {encoding *} $line]} {\n \t\t\t\t\t\tset enc [string tolower [string range $line 9 end]]\ndiff --git a/lib/commit.tcl b/lib/commit.tcl\nindex 3345149..9cc8410 100644\n--- a/lib/commit.tcl\n+++ b/lib/commit.tcl\n@@ -27,9 +27,8 @@ You are currently in the middle of a merge that has not been fully completed.  Y\n \tif {[catch {\n \t\t\tset fd [git_read cat-file commit $curHEAD]\n \t\t\tfconfigure $fd -encoding binary -translation lf\n-\t\t\tif {[catch {set enc $repo_config(i18n.commitencoding)}]} {\n-\t\t\t\tset enc utf-8\n-\t\t\t}\n+\t\t\t# By default commits are assumed to be in utf-8\n+\t\t\tset enc utf-8\n \t\t\twhile {[gets $fd line] > 0} {\n \t\t\t\tif {[string match {parent *} $line]} {\n \t\t\t\t\tlappend parents [string range $line 7 end]\n@@ -208,7 +207,7 @@ A good commit message has the following format:\n \tif {$use_enc ne {}} {\n \t\tfconfigure $msg_wt -encoding $use_enc\n \t} else {\n-\t\tputs stderr [mc \"warning: Tcl does not support encoding '%s'.\" $enc]\n+\t\terror_popup [mc \"warning: Tcl does not support encoding '%s'.\" $enc]\n \t\tfconfigure $msg_wt -encoding utf-8\n \t}\n \tputs $msg_wt $msg\n-- \n1.6.0.4.30.gf4240\n"}]}