remote-bzr: add utf-8 support for fetching
authorTimotheus Pokorra <timotheus.pokorra@gmail.com>
Sat, 6 Apr 2013 03:49:22 +0000 (21:49 -0600)
committerJunio C Hamano <gitster@pobox.com>
Sun, 7 Apr 2013 07:39:27 +0000 (00:39 -0700)
[fc: added tests]

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 0bcf8c5835dbb1a974523397746f0b444e27b7b6..0bd0759d7ffb9014c1bd12ee4bca69f53e4f8c2b 100755 (executable)
@@ -223,7 +223,7 @@ def export_files(tree, files):
             # is the blog already exported?
             if h in filenodes:
                 mark = filenodes[h]
-                final.append((mode, mark, path))
+                final.append((mode, mark, path.encode('utf-8')))
                 continue
 
             d = tree.get_file_text(fid)
@@ -240,7 +240,7 @@ def export_files(tree, files):
         print "data %d" % len(d)
         print d
 
-        final.append((mode, mark, path))
+        final.append((mode, mark, path.encode('utf-8')))
 
     return final
 
index 1a9c8d775cc7afb232b84af392291708bef33703..6eacf09a9bf5df5c04400bb59d558ab781be3fc2 100755 (executable)
@@ -179,4 +179,29 @@ test_expect_success 'different authors' '
   test_cmp expected actual
 '
 
+test_expect_success 'fetch utf-8 filenames' '
+  mkdir -p tmp && cd tmp &&
+  test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
+
+  export LC_ALL=en_US.UTF-8
+
+  (
+  bzr init bzrrepo &&
+  cd bzrrepo &&
+
+  echo test >> "áéíóú" &&
+  bzr add "áéíóú" &&
+  bzr commit -m utf-8
+  ) &&
+
+  (
+  git clone "bzr::$PWD/bzrrepo" gitrepo &&
+  cd gitrepo &&
+  git ls-files > ../actual
+  ) &&
+
+  echo "\"\\303\\241\\303\\251\\303\\255\\303\\263\\303\\272\"" > expected &&
+  test_cmp expected actual
+'
+
 test_done