summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Aguilar <davvid@gmail.com>2008-05-28 21:50:11 -0700
committerDavid Aguilar <davvid@gmail.com>2008-05-28 21:50:11 -0700
commita7129dc00826cb344c0202f152f1be33ea9326fe (patch)
tree180e3081d7a4daf5d971bfa8623387f7bc713406
parent85c6252b54108750291021a74dc00895f79a7ccf (diff)
downloadgitpython-a7129dc00826cb344c0202f152f1be33ea9326fe.tar.gz
git.py: add support for a GIT_PYTHON_TRACE environment variable
GIT_PYTHON_TRACE allows us to debug GitPython's usage of git through the use of an environment variable. This is preferred over a hard-coded print statement. Signed-off-by: David Aguilar <davvid@gmail.com>
-rw-r--r--lib/git_python/git.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/git_python/git.py b/lib/git_python/git.py
index 87087ca7..450f71fd 100644
--- a/lib/git_python/git.py
+++ b/lib/git_python/git.py
@@ -4,6 +4,9 @@ import re
from utils import *
from method_missing import MethodMissingMixin
+# Enables debugging of GitPython's git commands
+GIT_PYTHON_TRACE = os.environ.get("GIT_PYTHON_TRACE", False)
+
class Git(MethodMissingMixin):
"""
The Git class manages communication with the Git binary
@@ -24,7 +27,10 @@ class Git(MethodMissingMixin):
``command``
The command to execute
"""
- print ' '.join(command)
+
+ if GIT_PYTHON_TRACE:
+ print command
+
proc = subprocess.Popen(command,
cwd = self.git_dir,
stdout=subprocess.PIPE