remote-bzr: fix export of utf-8 authors
authorFelipe Contreras <felipe.contreras@gmail.com>
Wed, 28 Aug 2013 21:14:40 +0000 (16:14 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 29 Aug 2013 18:39:45 +0000 (11:39 -0700)
Reported-by: Joakim Verona <joakim@verona.se>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/remote-helpers/git-remote-bzr
contrib/remote-helpers/test-bzr.sh
index c3a3cac77b875b2cb925971e2baca141f9c4f163..08b0b61ee38eef5e901bfe7ee2b382cf422c9c32 100755 (executable)
@@ -168,6 +168,7 @@ class Parser:
         if not m:
             return None
         _, name, email, date, tz = m.groups()
+        name = name.decode('utf-8')
         committer = '%s <%s>' % (name, email)
         tz = int(tz)
         tz = ((tz / 100) * 3600) + ((tz % 100) * 60)
index dce281f91195cde4937b935910ec73f597bb826a..b0d70fd339048ba3c6898631459a9a26b1cb89b1 100755 (executable)
@@ -358,4 +358,34 @@ test_expect_success 'strip' '
        test_cmp expected actual
 '
 
+test_expect_success 'export utf-8 authors' '
+       test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C && unset GIT_COMMITTER_NAME" &&
+
+       LC_ALL=en_US.UTF-8
+       export LC_ALL
+
+       GIT_COMMITTER_NAME="GrĂ©goire"
+       export GIT_COMMITTER_NAME
+
+       bzr init bzrrepo &&
+
+       (
+       git init gitrepo &&
+       cd gitrepo &&
+       echo greg >> content &&
+       git add content &&
+       git commit -m one &&
+       git remote add bzr "bzr::../bzrrepo" &&
+       git push bzr
+       ) &&
+
+       (
+       cd bzrrepo &&
+       bzr log | grep "^committer: " > ../actual
+       ) &&
+
+       echo "committer: GrĂ©goire <committer@example.com>" > expected &&
+       test_cmp expected actual
+'
+
 test_done