Skip to content

Unicode characters in branch name #774

Closed
@timqsh

Description

@timqsh

Hi! I an trying to get diffs using GitPython, and i have an issue when branch name have unicode characters.

Here is repo where bug can be reproduced:
https://github.com/timqsh/test_git_python
branch:
МояВетка

when i run this code:

repo = git.Repo('.')
HEAD = repo.head.commit

i get this error:

Traceback (most recent call last):
  File ".\test.py", line 4, in <module>
    HEAD = repo.head.commit
  File "C:\Users\kushukov\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\refs\symbolic.py", line 200, in _get_commit
    obj = self._get_object()
  File "C:\Users\kushukov\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\refs\symbolic.py", line 193, in _get_object
    return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path)))
  File "C:\Users\kushukov\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\refs\symbolic.py", line 135, in dereference_recursive
    hexsha, ref_path = cls._get_ref_info(repo, ref_path)
  File "C:\Users\kushukov\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\refs\symbolic.py", line 184, in _get_ref_info
    return cls._get_ref_info_helper(repo, ref_path)
  File "C:\Users\kushukov\AppData\Local\Programs\Python\Python35-32\lib\site-packages\git\refs\symbolic.py", line 167, in _get_ref_info_helper
    raise ValueError("Reference at %r does not exist" % ref_path)
ValueError: Reference at 'refs/heads/Р\u045aР\u0455С\u040fР\u2019Р\xb5С\u201aРєР°' does not exist

I am testing this on Windows 10.

forgot to add:
GitPython 2.1.10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions