20 lines
563 B
Python
Executable file
20 lines
563 B
Python
Executable file
#!/usr/bin/env python
|
|
# Use this script in combination with the pre-commit.d directory inside .git/hooks/
|
|
# to run multiple scripts before commiting
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
if not os.path.isdir(".git"):
|
|
sys.exit("Please commit from the project root directory")
|
|
|
|
files = os.scandir(".git/hooks/pre-commit.d/")
|
|
|
|
for executable in files:
|
|
try:
|
|
subprocess.check_output(
|
|
[executable.path], universal_newlines=True, stderr=subprocess.STDOUT
|
|
)
|
|
except subprocess.CalledProcessError as e:
|
|
sys.exit(e.stdout)
|