[PATCH] D80978: Add a git hook script that can be manually setup to run some checks on every push
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 9 12:40:49 PDT 2020
MaskRay added inline comments.
================
Comment at: llvm/utils/git/pre-push.py:91
+def shell(cmd, strip=True, cwd=None, stdin=None, die_on_failure=True,
+ ignore_errors=False, text=True, print_raw_stderr=False):
+ # Escape args when logging for easy repro.
----------------
Are print_raw_stderr and ignore_errors and probably other arguments really used?
================
Comment at: llvm/utils/git/pre-push.py:116
+ if strip:
+ if text:
+ stdout = stdout.rstrip('\r\n')
----------------
`text` is always True. The other code path can be dropped.
================
Comment at: llvm/utils/git/pre-push.py:137
+
+def program_exists(cmd):
+ if sys.platform == 'win32' and not cmd.endswith('.exe'):
----------------
shutil.which
================
Comment at: llvm/utils/git/pre-push.py:146
+def get_revs_to_push(range):
+ commits = git('rev-list', range).splitlines()
+ # Reverse the order so we print the oldest commit first
----------------
return reversed(...)
================
Comment at: llvm/utils/git/pre-push.py:201
+ if not program_exists('git'):
+ die('error: cannot fine git command')
+
----------------
typo: find
================
Comment at: llvm/utils/git/pre-push.py:213
+
+ p.add_argument(
+ 'remote',
----------------
No need to wrap lines.
================
Comment at: llvm/utils/git/pre-push.py:226
+
+ lines=sys.stdin.readlines()
+ sys.stdin = open("/dev/tty", "r")
----------------
spaces around `=`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80978/new/
https://reviews.llvm.org/D80978
More information about the llvm-commits
mailing list