]> git.scottworley.com Git - git-cache/blame - git-pre-commit-hook
Release 1.5.0
[git-cache] / git-pre-commit-hook
CommitLineData
bef7ce53
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
d3b8a09d
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
bef7ce53
SW
30nix-shell --arg lint true --run './test.sh lint'
31
32popd