Set tracing to always on and save to .repo/TRACE_FILE.
- add `--trace_to_stderr` option so stderr will include trace outputs and any other errors that get sent to stderr
- while TRACE_FILE will only include trace outputs
piggy-backing on: https://gerrit-review.googlesource.com/c/git-repo/+/349154
Change-Id: I3895a84de4b2784f17fac4325521cd5e72e645e2
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/350114
Reviewed-by: LaMont Jones <lamontjones@google.com>
Tested-by: Joanna Wang <jojwang@google.com>
diff --git a/git_config.py b/git_config.py
index 6f80ae0..98cade3 100644
--- a/git_config.py
+++ b/git_config.py
@@ -349,9 +349,9 @@
except OSError:
return None
try:
- Trace(': parsing %s', self.file)
- with open(self._json) as fd:
- return json.load(fd)
+ with Trace(': parsing %s', self.file):
+ with open(self._json) as fd:
+ return json.load(fd)
except (IOError, ValueError):
platform_utils.remove(self._json, missing_ok=True)
return None