From a7129dc00826cb344c0202f152f1be33ea9326fe Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Wed, 28 May 2008 21:50:11 -0700 Subject: 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 --- lib/git_python/git.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/git_python/git.py') 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 -- cgit v1.2.1