I have a bash script:
#ts-precommit.sh
SRC_PATTERN=".*\.(ts|tsx)$"
if git diff --cached --name-only | grep --quiet -E "$SRC_PATTERN"
That I am running like so:
"husky": {
"hooks": {
"pre-commit": "sh ./ts-precommit.sh"
}
}
And I get the following output:
Not a git repository
To compare two paths outside a working tree:
usage: git diff [--no-index] <path> <path>
Any reasons why I wouldn't be able to call git from the script?