Skip to content
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

Fix UnicodeDecodeError in maybe_string #767

Merged
merged 1 commit into from
Feb 3, 2018

Conversation

atrubachev
Copy link
Contributor

This change fixes a problem with fetching the repository which has a branch with unicode symbols in its name.

For example

$ git branch
  branch-with—utf8
* master
$
In [1]: import pygit2

In [2]: repo = pygit2.Repository('utf8branchrepo')

In [3]: [b for b in repo.branches.local]
Out[3]: ['branch-with\xe2\x80\x94utf8', 'master']

In [4]: remote = repo.remotes.create('test', repo.workdir)

In [5]: remote.fetch()
---------------------------------------------------------------------------
UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-5-24fa60a13345> in <module>()
----> 1 remote.fetch()

/home/atrubachev/pygit2/venv/lib/python2.7/site-packages/pygit2/remote.pyc in fetch(self, refspecs, message, callbacks, prune)
    402                 err = C.git_remote_fetch(self._remote, arr, fetch_opts, to_bytes(message))
    403                 if callbacks._stored_exception:
--> 404                     raise callbacks._stored_exception
    405                 check_error(err)
    406         finally:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 29: ordinal not in range(128)

In [6]:

@jdavid jdavid merged commit ff50598 into libgit2:master Feb 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants