summaryrefslogtreecommitdiffstats
path: root/git_command.py
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-04-18 09:54:51 -0700
committerShawn O. Pearce <sop@google.com>2009-04-18 09:54:51 -0700
commitad3193a0e587073dee0edef46bdf24f6c6e09779 (patch)
tree84ed1894e6f590455ee361beb049c1c271c4e0e7 /git_command.py
parentb81ac9e65444d0f54d2b6dd24d20b74945c9a36a (diff)
downloadgit-repo-ad3193a0e587073dee0edef46bdf24f6c6e09779.tar.gz
Fix `repo --trace` to show ref and config loads
The value of the varible TRACE was copied during the import, which happens before the --trace option can be processed. So instead we now use a function to determine if the value is set, as the function can be safely copied early during import. Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'git_command.py')
-rw-r--r--git_command.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/git_command.py b/git_command.py
index a3bd9192..b6a4a343 100644
--- a/git_command.py
+++ b/git_command.py
@@ -17,18 +17,14 @@ import os
17import sys 17import sys
18import subprocess 18import subprocess
19from error import GitError 19from error import GitError
20from trace import REPO_TRACE, IsTrace, Trace
20 21
21GIT = 'git' 22GIT = 'git'
22MIN_GIT_VERSION = (1, 5, 4) 23MIN_GIT_VERSION = (1, 5, 4)
23GIT_DIR = 'GIT_DIR' 24GIT_DIR = 'GIT_DIR'
24REPO_TRACE = 'REPO_TRACE'
25 25
26LAST_GITDIR = None 26LAST_GITDIR = None
27LAST_CWD = None 27LAST_CWD = None
28try:
29 TRACE = os.environ[REPO_TRACE] == '1'
30except KeyError:
31 TRACE = False
32 28
33 29
34class _GitCall(object): 30class _GitCall(object):
@@ -101,7 +97,7 @@ class GitCommand(object):
101 else: 97 else:
102 stderr = None 98 stderr = None
103 99
104 if TRACE: 100 if IsTrace():
105 global LAST_CWD 101 global LAST_CWD
106 global LAST_GITDIR 102 global LAST_GITDIR
107 103
@@ -127,7 +123,7 @@ class GitCommand(object):
127 dbg += ' 1>|' 123 dbg += ' 1>|'
128 if stderr == subprocess.PIPE: 124 if stderr == subprocess.PIPE:
129 dbg += ' 2>|' 125 dbg += ' 2>|'
130 print >>sys.stderr, dbg 126 Trace('%s', dbg)
131 127
132 try: 128 try:
133 p = subprocess.Popen(command, 129 p = subprocess.Popen(command,