remote-bzr: fix export of utf-8 authors
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>
Felipe Contreras committed
Aug 28, 2013 at 16:14 UTC
a8c0b74718d9986aec758e4a834a2d7363b16f24
2 files changed
+31
contrib/remote-helpers/git-remote-bzr
+1
@@ -168,6 +168,7 @@ class Parser:
168
if not m:
169
return None
170
_, name, email, date, tz = m.groups()
171
+ name = name.decode('utf-8')
172
committer = '%s <%s>' % (name, email)
173
tz = int(tz)
174
tz = ((tz / 100) * 3600) + ((tz % 100) * 60)
contrib/remote-helpers/test-bzr.sh
+30
@@ -358,4 +358,34 @@ test_expect_success 'strip' '
358
test_cmp expected actual
359
'
360
361
+test_expect_success 'export utf-8 authors' '
362
+ test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C && unset GIT_COMMITTER_NAME" &&
363
+
364
+ LC_ALL=en_US.UTF-8
365
+ export LC_ALL
366
+
367
+ GIT_COMMITTER_NAME="Grégoire"
368
+ export GIT_COMMITTER_NAME
369
+
370
+ bzr init bzrrepo &&
371
+
372
+ (
373
+ git init gitrepo &&
374
+ cd gitrepo &&
375
+ echo greg >> content &&
376
+ git add content &&
377
+ git commit -m one &&
378
+ git remote add bzr "bzr::../bzrrepo" &&
379
+ git push bzr
380
+ ) &&
381
+
382
+ (
383
+ cd bzrrepo &&
384
+ bzr log | grep "^committer: " > ../actual
385
+ ) &&
386
+
387
+ echo "committer: Grégoire <committer@example.com>" > expected &&
388
+ test_cmp expected actual
389
+'
390
+
391
test_done