]> git.scottworley.com Git - pinch/blame_incremental - git-pre-commit-hook
Release 3.0.15
[pinch] / git-pre-commit-hook
... / ...
CommitLineData
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
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
30nix-shell --arg lint true --run './test.sh lint'
31
32popd