Skip to content

Cannot add utf8 path to repository #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
albbas opened this issue Jul 29, 2015 · 1 comment
Closed

Cannot add utf8 path to repository #331

albbas opened this issue Jul 29, 2015 · 1 comment

Comments

@albbas
Copy link

albbas commented Jul 29, 2015

Running the code below on a Linux machine with PythonGit 1.0.1 fails, but works with PythonGit 0.3.2 RC1

Python version: 2.7.10

Output when using PythonGit 1.0.1:
1.0.1
Traceback (most recent call last):
File "corpustools/test/test_git.py", line 11, in
r.index.add(['ø.txt'])
File "/usr/local/lib/python2.7/dist-packages/git/index/base.py", line 780, in add
self.write(ignore_extension_data=not write_extension_data)
File "/usr/local/lib/python2.7/dist-packages/git/index/base.py", line 213, in write
self._serialize(stream, ignore_extension_data)
File "/usr/local/lib/python2.7/dist-packages/git/index/base.py", line 180, in _serialize
write_cache(entries, stream, extension_data)
File "/usr/local/lib/python2.7/dist-packages/git/index/fun.py", line 132, in write_cache
write(path.encode(defenc))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)

Output when using PythonGit 0.3.2 RC1
0.3.2 RC1

This is the version that is installed by the distribution (Kubuntu 15.10)

# -*- coding:utf-8 -*-
import git
import testfixtures

print git.__version__

tempdir = testfixtures.TempDirectory(ignore=['.git'])
tempdir.makedir('orig/smj/ficti/sub')
tempdir.write('orig/smj/ficti/sub/ø.txt', 'content of ø')

r = git.Repo.init(tempdir.path)
r.index.add(['orig'])
r.index.commit('Added orig and prestable')

tempdir.cleanup()
@Byron Byron added this to the v1.0.2 - Fixes milestone Jul 29, 2015
@Byron Byron closed this as completed in 7ab12b4 Jul 29, 2015
@Byron
Copy link
Member

Byron commented Jul 30, 2015

You can watch the development stream on youtube.

GitPython #18 [issue 331 - adding strings with utf-8 characters in python 2]

thumb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants