Skip to content

Nonascii Files in the Repository #320

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
abbgrade opened this issue Jul 18, 2015 · 6 comments
Closed

Nonascii Files in the Repository #320

abbgrade opened this issue Jul 18, 2015 · 6 comments
Assignees

Comments

@abbgrade
Copy link

Hi,

i want to run GitPython unter Windows with nonascii filenames in the repository.

repo.index.add(repo.untracked_files)

does not work.

for untracked_file in repo.untracked_files:
bar = untracked_file.decode('utf-8')
foo = bar.encode('1252')
repo.git.add(foo)

works.

Is there a way to use unicode directly?

@Byron
Copy link
Member

Byron commented Jul 18, 2015

My first guess is that repo.untracked_files should probably return the expected unicode instances directly.

It would be interesting to know which GitPython version you are using (and I assume it runs in Python 2), and also the name of a file that cannot be added.

Finally, can you share a stacktrace in the does not work case ?

@Byron Byron added this to the v1.0.2 - Fixes milestone Jul 18, 2015
@abbgrade
Copy link
Author

Thanks for the fast response!

The version is 1.0.1 for Python 2.7 from pip.

The stacktrace is:

File "C:\Python27\lib\site-packages\git\index\base.py", line 726, in add entries_added.extend(self._entries_for_paths(paths, path_rewriter, fprogress, entries))
  File "C:\Python27\lib\site-packages\git\util.py", line 54, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Python27\lib\site-packages\git\index\util.py", line 84, in set_git_working_dir
    return func(self, *args, **kwargs)
  File "C:\Python27\lib\site-packages\git\index\base.py", line 612, in _entries_for_paths
    entries_added.append(self._store_path(filepath, fprogress))
  File "C:\Python27\lib\site-packages\git\index\base.py", line 571, in _store_path
    st = os.lstat(filepath)     # handles non-symlinks as well
WindowsError: [Error 2] Das System kann die angegebene Datei nicht finden: 'test.sql - Verkn\xc3\xbcpfung.lnk'

So the problem is obviously the 'ü' which is converted to '\xc3\xbc'.

@Byron Byron self-assigned this Jul 20, 2015
@Byron Byron closed this as completed in 9c272ab Jul 20, 2015
@Byron
Copy link
Member

Byron commented Jul 20, 2015

This should be fixed in the latest version from github. Thanks for posting the issue, I found plenty of related issues in the process of fixing it.

@Byron
Copy link
Member

Byron commented Jul 20, 2015

You can watch the development stream on youtube.

GitPython #16 [issue 320 - encodings and other messes]

thumb

@abbgrade
Copy link
Author

Thanks! That fixed it.

Is the low resolution of the video on purpose? Its hard to read on 360p.

@Byron
Copy link
Member

Byron commented Jul 20, 2015

Good to hear !

The video is available in 1080p - YouTube usually takes longer to finally provide higher resolutions though, starting at the lowest one. When I checked it a moment ago, it was already available in 1080p though.

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