From e4d3809161fc54d6913c0c2c7f6a7b51eebe223f Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 21 Jan 2015 18:34:58 +0100 Subject: Added advance usage examples to tutorial and made minor fixes. GIT_PYTHON_TRACE would actually fail (now) if we debugged archive operations. Related to #239 --- git/cmd.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'git/cmd.py') diff --git a/git/cmd.py b/git/cmd.py index d6b29d91..55ed74dd 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -579,11 +579,16 @@ class Git(LazyMixin): if self.GIT_PYTHON_TRACE == 'full': cmdstr = " ".join(command) + + def as_text(stdout_value): + return not output_stream and stdout_value.decode(defenc) or '' + # end + if stderr_value: log.info("%s -> %d; stdout: '%s'; stderr: '%s'", - cmdstr, status, stdout_value.decode(defenc), stderr_value.decode(defenc)) + cmdstr, status, as_text(stdout_value), stderr_value.decode(defenc)) elif stdout_value: - log.info("%s -> %d; stdout: '%s'", cmdstr, status, stdout_value.decode(defenc)) + log.info("%s -> %d; stdout: '%s'", cmdstr, status, as_text(stdout_value)) else: log.info("%s -> %d", cmdstr, status) # END handle debug printing -- cgit v1.2.1