Skip to content

Nonascii Files in the Repository #320

Description

@abbgrade

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?

Activity

  1. Byron commented on Jul 18, 2015

    @Byron
    Member

    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 ?

  2. added this to the v1.0.2 - Fixes milestone on Jul 18, 2015
  3. abbgrade commented on Jul 19, 2015

    @abbgrade
    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'.

  4. self-assigned this
    on Jul 20, 2015
  5. Byron commented on Jul 20, 2015

    @Byron
    Member

    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.

  6. Byron commented on Jul 20, 2015

    @Byron
    Member

    You can watch the development stream on youtube.

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

    thumb

  7. abbgrade commented on Jul 20, 2015

    @abbgrade
    Author

    Thanks! That fixed it.

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

  8. Byron commented on Jul 20, 2015

    @Byron
    Member

    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions