summaryrefslogtreecommitdiff
path: root/testsuite/driver/perf_notes.py
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2018-12-01 09:28:57 -0500
committerBen Gamari <ben@smart-cactus.org>2018-12-01 09:28:57 -0500
commit3b075e1a96564f29130540d933d07840c59a0feb (patch)
treeedbb06b6ccbac2f5e876e36ce6f1d0f808dd0954 /testsuite/driver/perf_notes.py
parentcd793325e3e71cee761df35df0934999f7d77ad7 (diff)
downloadhaskell-3b075e1a96564f29130540d933d07840c59a0feb.tar.gz
testsuite: Don't use git status to determine whether we are inside a repo
Git status is extremely expensive for this task. We instead use `git rev-parse HEAD` and throw away the output to ensure we don't spam the user.
Diffstat (limited to 'testsuite/driver/perf_notes.py')
-rw-r--r--testsuite/driver/perf_notes.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/testsuite/driver/perf_notes.py b/testsuite/driver/perf_notes.py
index c275041252..5ceede7be2 100644
--- a/testsuite/driver/perf_notes.py
+++ b/testsuite/driver/perf_notes.py
@@ -20,11 +20,12 @@ from math import ceil, trunc
from testutil import passed, failBecause
-# Check if "git status" can be run successfully.
+# Check if "git rev-parse" can be run successfully.
# True implies the current directory is a git repo.
-def can_git_status():
+def inside_git_repo():
try:
- subprocess.check_call(['git', 'status'])
+ subprocess.check_call(['git', 'rev-parse', 'HEAD'],
+ stdout=subprocess.DEVNULL)
return True
except subprocess.CalledProcessError:
return False
@@ -388,4 +389,4 @@ if __name__ == '__main__':
# Printing out percentages.
for test, metric in all_tests:
- print("{:27}{:30}".format(test, metric) + commit_string(test,'percentages')) \ No newline at end of file
+ print("{:27}{:30}".format(test, metric) + commit_string(test,'percentages'))