diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2015-01-09 12:49:03 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2015-01-09 12:49:03 +0100 |
commit | 17f5d13a7a741dcbb2a30e147bdafe929cff4697 (patch) | |
tree | 7794ddd8ace09c62627bb1639656f410267718b7 /git/cmd.py | |
parent | 1531d789df97dbf1ed3f5b0340bbf39918d9fe48 (diff) | |
download | gitpython-17f5d13a7a741dcbb2a30e147bdafe929cff4697.tar.gz |
Added test to assure blame can deal with binary patches.
Fixes #74
Diffstat (limited to 'git/cmd.py')
-rw-r--r-- | git/cmd.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -31,7 +31,7 @@ from git.compat import ( ) execute_kwargs = ('istream', 'with_keep_cwd', 'with_extended_output', - 'with_exceptions', 'as_process', + 'with_exceptions', 'as_process', 'stdout_as_string', 'output_stream') log = logging.getLogger('git.cmd') @@ -411,6 +411,7 @@ class Git(LazyMixin): with_exceptions=True, as_process=False, output_stream=None, + stdout_as_string=True, **subprocess_kwargs ): """Handles executing the command on the shell and consumes and returns @@ -454,6 +455,11 @@ class Git(LazyMixin): output pipe to the given output stream directly. Judging from the implementation, you shouldn't use this flag ! + :param stdout_as_string: + if False, the commands standard output will be bytes. Otherwise, it will be + decoded into a string using the default encoding (usually utf-8). + The latter can fail, if the output contains binary data. + :param subprocess_kwargs: Keyword arguments to be passed to subprocess.Popen. Please note that some of the valid kwargs are already set by this method, the ones you @@ -545,7 +551,7 @@ class Git(LazyMixin): else: raise GitCommandError(command, status, stderr_value) - if isinstance(stdout_value, bytes): # could also be output_stream + if isinstance(stdout_value, bytes) and stdout_as_string: # could also be output_stream stdout_value = stdout_value.decode(defenc) # Allow access to the command's status code |