This is probably something silly, but searching around I haven't been able to find the answer. I'm trying to setup pre-commit hooks for my git project in a way that the scripts can be versioned along with the source.
It seemed like symlinks are supported and the way to go for this. When I try to ln with anything in the .git directory I get the error "No such file or directory". Is there something weird about the way the .git directory is setup? I'm doing this through cygwin on Windows right now, in case that's pertinent.
For example, the script I'm using to setup the symlinks looks like:
#/bin/bash
HOOK_NAMES="pre-commit post-commit"
THIS_SCRIPT_DIR=$(dirname $0)
HOOK_DIR=$THIS_SCRIPT_DIR/../.git/hooks
for hook in $HOOK_NAMES; do
ln -s -f $THIS_SCRIPT_DIR/git-hooks/$hook $HOOK_DIR/$hook
done
Thanks,
====
Followup: This does appear to be an issue with Cygwin, though I haven't been able to find documentation that explains it. This works fine on Linux and OS X. Cygwin is having issues creating symlinks in an implicitly hidden folder (. prefixed). If anyone knows why I'll happily tag that explanation as an answer.