diff options
Diffstat (limited to 'testsuite/driver/perf_notes.py')
-rw-r--r-- | testsuite/driver/perf_notes.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py index 365732ca69..2b4835392c 100644 --- a/testsuite/driver/perf_notes.py +++ b/testsuite/driver/perf_notes.py @@ -23,13 +23,17 @@ from testutil import passed, failBecause # Check if "git rev-parse" can be run successfully. # True implies the current directory is a git repo. +_inside_git_repo_cache = None def inside_git_repo(): - try: - subprocess.check_call(['git', 'rev-parse', 'HEAD'], - stdout=subprocess.DEVNULL) - return True - except subprocess.CalledProcessError: - return False + global _inside_git_repo_cache + if _inside_git_repo_cache == None: + try: + subprocess.check_call(['git', 'rev-parse', 'HEAD'], + stdout=subprocess.DEVNULL) + _inside_git_repo_cache = True + except subprocess.CalledProcessError: + _inside_git_repo_cache = False + return _inside_git_repo_cache # Check if the worktree is dirty. def is_worktree_dirty(): |