X-Git-Url: http://git.scottworley.com/pinch/blobdiff_plain/10ddbaff0197f0ef93a910d7ea3f9f7d0ebac3a4..d2d9efeffd9867660166926c6ac3262b8d22e111:/git-pre-commit-hook diff --git a/git-pre-commit-hook b/git-pre-commit-hook new file mode 100755 index 0000000..7db6818 --- /dev/null +++ b/git-pre-commit-hook @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# Copy me to .git/hooks/pre-commit + +set -e + +cleanup() { + if [[ "$D" && -e "$D" ]];then + rm -rf "$D" + fi +} +trap cleanup EXIT + +D=$(mktemp -d) +[[ "$D" && -d "$D" ]] + +git checkout-index --prefix="$D/" -a +pushd "$D" + +nix-shell --run ./test.sh + +popd