I have a pre-commit hook that when I run returns this error:
error: cannot spawn .git/hooks/pre-commit: No error
I have a #!/bin/sh
at the top and have definitely used chmod +x
on it. However, those appear to be fixes for when there is a no such file or directory error. My error simply says No error
and I cannot work out why.
Code in the hook:
#!/bin/sh
changes() {
git diff --name-only --diff-filter=AMDR --cached @~..@
}
if changes | grep -q dirname {
echo "Test"
}