Skip to content

Commit 51899ef

Browse files
committed
Handle ./pre-commit being called directly and not as a git hook
1 parent a727442 commit 51899ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
set -e
33

4-
if git diff --cached --name-only | grep -E '.(js|json)$'; then
4+
if [ "$(dirname "$0")" != ".git/hooks" ] || git diff --cached --name-only | grep -E '.(js|json)$'; then
55
yarn install
66
yarn run package
77
exec git add dist/index.js

0 commit comments

Comments
 (0)