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"
}
bash
(#!/bin/bash
) ? I'm not suresh
is set up as you would expect when runninggit-bash
on Windows.sh.exe
alongsidebash.exe
in Git for Windows, but... a--version
on both return the sameGNU bash, version 4.4.23(1)-release (x86_64-pc-msys)
. I meansh -c "if [[ "aa" == "aa" ]]; then echo "ok"; fi"
will work (print "ok
"), even thoughsh
is not supposed to support[[ ... ]]
(as explained in stackoverflow.com/a/42666651/6309)