From ebf46561837f579d202d7bd4a22362f24fb858a4 Mon Sep 17 00:00:00 2001 From: Victor Luzgin Date: Sat, 26 Oct 2019 19:24:08 +0300 Subject: Fix #920 --- git/cmd.py | 2 +- git/test/test_repo.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/git/cmd.py b/git/cmd.py index 484a0181..1cb3df34 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -401,7 +401,7 @@ class Git(LazyMixin): :raise GitCommandError: if the return status is not 0""" if stderr is None: stderr = b'' - stderr = force_bytes(stderr) + stderr = force_bytes(data=stderr, encoding='utf-8') status = self.proc.wait() diff --git a/git/test/test_repo.py b/git/test/test_repo.py index de1e951a..c59203ed 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -245,6 +245,20 @@ class TestRepo(TestBase): assert_equal(cloned.config_reader().get_value('core', 'filemode'), False) assert_equal(cloned.config_reader().get_value('submodule "repo"', 'update'), 'checkout') + def test_clone_from_with_path_contains_unicode(self): + with tempfile.TemporaryDirectory() as tmpdir: + unicode_dir_name = '\u0394' + path_with_unicode = os.path.join(tmpdir, unicode_dir_name) + os.makedirs(path_with_unicode) + + try: + Repo.clone_from( + url=self._small_repo_url(), + to_path=path_with_unicode, + ) + except UnicodeEncodeError: + self.fail('Raised UnicodeEncodeError') + @with_rw_repo('HEAD') def test_max_chunk_size(self, repo): class TestOutputStream(object): -- cgit v1.2.1