Skip to content

Fix cloning to path with unicode #955

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

Merged
merged 1 commit into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def wait(self, stderr=b''): # TODO: Bad choice to mimic `proc.wait()` but with
: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()

Expand Down
14 changes: 14 additions & 0 deletions git/test/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@ def test_clone_from_pathlib_withConfig(self, rw_dir):
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):
Expand Down