From 51899ef157c6d3a6d0ba63363df728205b1431f0 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 9 Sep 2022 09:46:27 +0200 Subject: [PATCH] Handle ./pre-commit being called directly and not as a git hook --- pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre-commit b/pre-commit index 60d6877..317b5bf 100755 --- a/pre-commit +++ b/pre-commit @@ -1,7 +1,7 @@ #!/bin/sh set -e -if git diff --cached --name-only | grep -E '.(js|json)$'; then +if [ "$(dirname "$0")" != ".git/hooks" ] || git diff --cached --name-only | grep -E '.(js|json)$'; then yarn install yarn run package exec git add dist/index.js