Skip to content

Commit 5445b24

Browse files
tpokorragitster
authored andcommitted
remote-bzr: add utf-8 support for fetching
[fc: added tests] Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 8954441 commit 5445b24

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

contrib/remote-helpers/git-remote-bzr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def export_files(tree, files):
223223
# is the blog already exported?
224224
if h in filenodes:
225225
mark = filenodes[h]
226-
final.append((mode, mark, path))
226+
final.append((mode, mark, path.encode('utf-8')))
227227
continue
228228

229229
d = tree.get_file_text(fid)
@@ -240,7 +240,7 @@ def export_files(tree, files):
240240
print "data %d" % len(d)
241241
print d
242242

243-
final.append((mode, mark, path))
243+
final.append((mode, mark, path.encode('utf-8')))
244244

245245
return final
246246

contrib/remote-helpers/test-bzr.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,29 @@ test_expect_success 'different authors' '
179179
test_cmp expected actual
180180
'
181181

182+
test_expect_success 'fetch utf-8 filenames' '
183+
mkdir -p tmp && cd tmp &&
184+
test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
185+
186+
export LC_ALL=en_US.UTF-8
187+
188+
(
189+
bzr init bzrrepo &&
190+
cd bzrrepo &&
191+
192+
echo test >> "áéíóú" &&
193+
bzr add "áéíóú" &&
194+
bzr commit -m utf-8
195+
) &&
196+
197+
(
198+
git clone "bzr::$PWD/bzrrepo" gitrepo &&
199+
cd gitrepo &&
200+
git ls-files > ../actual
201+
) &&
202+
203+
echo "\"\\303\\241\\303\\251\\303\\255\\303\\263\\303\\272\"" > expected &&
204+
test_cmp expected actual
205+
'
206+
182207
test_done

0 commit comments

Comments
 (0)