Package: git-gui
Version: 1:2.11.0-3
Severity: normal
Tags: patch

Dear Maintainer,
using "git gui" to "Amend Last Commit" scrambles the
"Author" name in the commit, if the name contains at least a "Ü".

A "new" commit is not affected. But on every amend it gets
scrambled more.

New:     From: =?UTF-8?q?Test=20=C3=9Ctest?= <test@localhost>
Amend 1: From: =?UTF-8?q?Test=20=C3=83=C2=9Ctest?= <test@localhost>
Amend 2: From: =?UTF-8?q?Test=20=C3=83=C2=83=C3=82=C2=9Ctest?= <test@localhost>
...

I tried to report this issue upstream here [1], but it seems
I failed to put the right persons on CC.

Attached patch tries to maintain encoding.
Also a file containing commands to reproduce is attached.

Kind regards,
Bernhard


[1] http://www.spinics.net/lists/git/msg295855.html



-- System Information:
Debian Release: 9.0
  APT prefers testing-proposed-updates
  APT policy: (500, 'testing-proposed-updates'), (500, 'testing-debug'), (500, 
'testing')
Architecture: amd64
 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-3-amd64 (SMP w/16 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages git-gui depends on:
ii  git  1:2.11.0-3
ii  tk   8.6.0+9

Versions of packages git-gui recommends:
ii  gitk  1:2.11.0-3

Versions of packages git-gui suggests:
ii  aspell   0.60.7~20110707-3+b2
ii  git-doc  1:2.11.0-3

-- no debconf information
mkdir test
cd test
git init
git config user.name "Test Ütest"
git config user.email "test@localhost"

echo 1 > testfile
git add testfile
git commit -m "Test commit."
git format-patch --keep-subject -o . -1
cat ./0001-Test-commit.patch | grep From:
    From: =?UTF-8?q?Test=20=C3=9Ctest?= <test@localhost>

echo 2 > testfile
echo $LANG
    de_DE.UTF-8
git gui&
    Kontext zur Bereitstellung Hinzufügen (Stage Hunk For Commit)
    Letzte nachbessern (Amend Last Commit)
    Eintragen (Commit)
    Ctrl+Q
git format-patch --keep-subject -o . -1
cat ./0001-Test-commit.patch | grep From:
    From: =?UTF-8?q?Test=20=C3=83=C2=9Ctest?= <test@localhost>

-----

From: =?UTF-8?q?Test=20=C3=9Ctest?= <test@localhost>
From: =?UTF-8?q?Test=20=C3=83=C2=9Ctest?= <test@localhost>
From: =?UTF-8?q?Test=20=C3=83=C2=83=C3=82=C2=9Ctest?= <test@localhost>
From: =?UTF-8?q?Test=20=C3=83=C2=83=C3=82=C2=83=C3=83=C2=82=C3=82=C2=9Ctes?=
 =?UTF-8?q?t?= <test@localhost>
>From eaa17c49d8dd7f9fd52dba5d0b42a9ffc4e8a323 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernha...@mailbox.org>
Date: Tue, 14 Feb 2017 23:21:26 +0100
Subject: [PATCH/RFC] git-gui: Fix author name encoding in Amend Last Commit.

In "New Commit" author name is set correctly.
But when doing "Amend Last Commit" the encoding gets wrong.

This patch adds in load_last_commit a similar assignment converting
to tcl encoding for commit_author as already exists for msg.
---
 lib/commit.tcl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/commit.tcl b/lib/commit.tcl
index 83620b7..f5357f2 100644
--- a/lib/commit.tcl
+++ b/lib/commit.tcl
@@ -46,6 +46,9 @@ You are currently in the middle of a merge that has not been 
fully completed.  Y
                                set msg [encoding convertfrom $enc $msg]
                        }
                        set msg [string trim $msg]
+                       if {$enc ne {}} {
+                               set commit_author [encoding convertfrom $enc 
$commit_author]
+                       }
                } err]} {
                error_popup [strcat [mc "Error loading commit data for amend:"] 
"\n\n$err"]
                return
-- 
2.11.0

Reply via email to