Skip to content

Commit f6f4567

Browse files
committed
updated .envrc
1 parent a0a9961 commit f6f4567

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.envrc

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,23 @@ srcdir="$(cd "$(dirname "$src")" && pwd)"
5252

5353
# Automatically install Pre-Commit Git hooks if not already present
5454

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+
5565
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
5972
pre-commit install
6073
fi
6174
fi

0 commit comments

Comments
 (0)