Allow clang-format in presubmit to be disabled
By having 'disable-clang-format' in commit message. If you have the script setup as git pre-commit, it can be disabled by '--no-verify' option. Change-Id: I6fb358e85105255fddde41f950e986c74b7defc9
This commit is contained in:
parent
a78c3d3224
commit
ba3e054e7e
|
@ -36,6 +36,12 @@ import subprocess
|
|||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
is_pre_commit_hook = len(sys.argv) == 1
|
||||
if not is_pre_commit_hook:
|
||||
output = subprocess.check_output(['git', 'log', '--pretty=full', '-1'])
|
||||
if 'disable-clang-format' in output:
|
||||
sys.exit(0)
|
||||
|
||||
command = ['git', 'clang-format', '--style', 'Chromium']
|
||||
command += sys.argv[1:]
|
||||
output = subprocess.check_output(command + ['--diff'])
|
||||
|
|
Loading…
Reference in New Issue