summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Thiel <byronimo@gmail.com>2016-06-20 06:49:45 +0200
committerSebastian Thiel <byronimo@gmail.com>2016-06-20 06:49:45 +0200
commit07a8f73dca7ec7c2aeb6aa47aaf421d8d22423ad (patch)
treea1e78b873bb5b15cbb8e974fb6d054f57d1590e4
parent5e02afbb7343a7a4e07e3dcf8b845ea2764d927c (diff)
parent930d03fb077f531b3fbea1b4da26a96153165883 (diff)
downloadgitpython-07a8f73dca7ec7c2aeb6aa47aaf421d8d22423ad.tar.gz
Merge branch 'master' into fix-non-ascii-chars-in-status-lines
-rw-r--r--git/cmd.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/git/cmd.py b/git/cmd.py
index 82434673..d8469565 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -39,7 +39,8 @@ from git.compat import (
PY3,
bchr,
# just to satisfy flake8 on py3
- unicode
+ unicode,
+ safe_decode,
)
execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output',
@@ -693,12 +694,12 @@ class Git(LazyMixin):
cmdstr = " ".join(command)
def as_text(stdout_value):
- return not output_stream and stdout_value.decode(defenc) or '<OUTPUT_STREAM>'
+ return not output_stream and safe_decode(stdout_value) or '<OUTPUT_STREAM>'
# end
if stderr_value:
log.info("%s -> %d; stdout: '%s'; stderr: '%s'",
- cmdstr, status, as_text(stdout_value), stderr_value.decode(defenc))
+ cmdstr, status, as_text(stdout_value), safe_decode(stderr_value))
elif stdout_value:
log.info("%s -> %d; stdout: '%s'", cmdstr, status, as_text(stdout_value))
else:
@@ -712,11 +713,11 @@ class Git(LazyMixin):
raise GitCommandError(command, status, stderr_value)
if isinstance(stdout_value, bytes) and stdout_as_string: # could also be output_stream
- stdout_value = stdout_value.decode(defenc)
+ stdout_value = safe_decode(stdout_value)
# Allow access to the command's status code
if with_extended_output:
- return (status, stdout_value, stderr_value.decode(defenc))
+ return (status, stdout_value, safe_decode(stderr_value))
else:
return stdout_value