]> git.scottworley.com Git - pinch/blame - git-pre-commit-hook
fallback git-cache 1.4.3 -> 1.5.0 for "git_ref = tag <tag>" support
[pinch] / git-pre-commit-hook
CommitLineData
d2d9efef
SW
1#!/usr/bin/env bash
2
3# Copy me to .git/hooks/pre-commit
4
5set -e
6
7cleanup() {
8 if [[ "$D" && -e "$D" ]];then
9 rm -rf "$D"
10 fi
11}
12trap cleanup EXIT
13
14D=$(mktemp -d)
15[[ "$D" && -d "$D" ]]
16
17git checkout-index --prefix="$D/" -a
18pushd "$D"
19
e99a249b
SW
20# So we don't confuse the inner git invocations inside the tests with
21# the outer git invocation that's trying to commit a change.
22unset GIT_AUTHOR_DATE
23unset GIT_AUTHOR_EMAIL
24unset GIT_AUTHOR_NAME
25unset GIT_CONFIG_PARAMETERS
26unset GIT_EXEC_PATH
27unset GIT_INDEX_FILE
28unset GIT_PREFIX
29
420bd8c9 30nix-shell --arg lint true --run './test.sh lint'
d2d9efef
SW
31
32popd