File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -52,10 +52,23 @@ srcdir="$(cd "$(dirname "$src")" && pwd)"
52
52
53
53
# Automatically install Pre-Commit Git hooks if not already present
54
54
55
+ if ! type -P pre-commit & > /dev/null &&
56
+ uname -s | grep -q Darwin &&
57
+ type -P brew & > /dev/null; then
58
+ echo
59
+ echo " Pre-commit is not installed - installing now..."
60
+ echo
61
+ brew install pre-commit
62
+ echo
63
+ fi
64
+
55
65
if [ -f .pre-commit-config.yaml ] &&
56
- [ -d .git ] &&
57
- type -P pre-commit & > /dev/null; then
58
- if ! [ -f .git/hooks/pre-commit ]; then
66
+ type -P pre-commit & > /dev/null &&
67
+ git rev-parse --is-inside-work-tree & > /dev/null; then
68
+ if ! [ -f " $( git rev-parse --show-toplevel) /.git/hooks/pre-commit" ]; then
69
+ echo
70
+ echo " Pre-commit hook is not installed in local Git repo checkout - installing now..."
71
+ echo
59
72
pre-commit install
60
73
fi
61
74
fi
You can’t perform that action at this time.
0 commit comments