Add hooks branch for VTK-m so that developers can get some pre-commit checks
easily.
Commands used to setup GitSetup:
git remote add -f setup https://robertmaynard@gitlab.kitware.com/utils/gitsetup.git
git merge --no-commit --allow-unrelated-histories setup/hooks
git read-tree -u --prefix=. setup/hooks
Read from the project ".hooks-config" a configuration value
hooks.start.commit-msg
hooks.start.pre-commit
hooks.start.prepare-commit-msg
to run from our respective hook before its main checks.
Some hooks were getting referenced directly via $GIT_DIR/hooks while at
other times getting referenced relative via ${BASH_SOURCE%/*}. By making
all references relative then these hooks can reside in a different folder
and still be daisy-chained by other hooks.
Although it seems reasonable to expect GIT_DIR to be set when
hooks are invoked, the "git help hooks" documentation does not
guarantee it. On msysGit 1.7.8 (and perhaps others) "git gui"
runs prepare-commit-msg without setting GIT_DIR. Set GIT_DIR
at the beginning of each commit hook if it is not already set.
The "git merge" command generates its own commit message and does not
invoke the commit-msg hook. Fortunately it invokes prepare-commit-msg
so teach it to call the gerrit/commit-msg hook for merges.
Suggested-by: Chris Harris <chris.harris@kitware.com>
Look for a ".hooks-config.bash" file at the top of the work tree.
Load it in each hook to get per-project configuration. Currently
we do not define any config options, but this adds the framework.
Chain the pre-commit, commit-msg, and prepare-commit-msg hooks to
locally configured scripts. Interpret relative paths with respect to
the working directory where the hooks run (top of work tree). This
allows project setup scripts to add project-specific checks for each of
these hooks.