felipec / git

Fork of Junio Hamano's git for users
Other
204 stars 34 forks source link

problem with clone of bzr when umlaut in filename in code #25

Closed tpokorra closed 11 years ago

tpokorra commented 11 years ago

I run this command: git clone "bzr::lp:openpetraorg"

and get this stacktrace:

progress revision timotheus.pokorra@solidcharity.com-20120227100551-0vj3q83rc3zp4v97 (4000/5872) Traceback (most recent call last): File "/usr/bin/git-remote-bzr", line 739, in sys.exit(main(sys.argv)) File "/usr/bin/git-remote-bzr", line 730, in main do_import(parser) File "/usr/bin/git-remote-bzr", line 358, in do_import export_branch(branch, name) File "/usr/bin/git-remote-bzr", line 314, in export_branch print "M %s :%u %s" % f UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 59: ordinal not in range(128) fatal: stream ends early fast-import: dumping crash report to /home/timotheusp/openpetragit2/openpetraorg/.git/fast_import_crash_13837 fatal: Error while running fast-import

I did some debugging, and the content of f in line 314 is: ('100644', 28670, u'webserver/Samples/UploadDemo/388px-Droste-H\xfclshoff_2.jpg') The name in bzr is: 388px-Droste-Hülshoff_2.jpg

I tried already to encode the filename as ascii, with path.encode('ascii', 'replace') in export_files line 243, but that did not help. I do not know enough about python...

Thanks for this nice tool!

tpokorra commented 11 years ago

ok, forgot to use encode('ascii', 'replace') in line 226 as well. now it works with this workaround, even though the filename is not the original.

tpokorra commented 11 years ago

even better would be in line 226 and 243: final.append((mode, mark, path.encode('utf-8'))) This properly keeps the Umlaut in the filename.

tpokorra commented 11 years ago

I have added pull request https://github.com/felipec/git/pull/26

felipec commented 11 years ago

Thanks. Closing now.