Skip to content

Instantly share code, notes, and snippets.

@philgebhardt
Last active October 13, 2018 22:14
Show Gist options
  • Save philgebhardt/8409008597d66d933767c9b2d8fda22f to your computer and use it in GitHub Desktop.
Save philgebhardt/8409008597d66d933767c9b2d8fda22f to your computer and use it in GitHub Desktop.
Git post-receive hook built for running `make check`
#!/bin/bash
set -e
set -o pipefail
set -x
WORKTREE=
GITDIR=
test -z $WORKTREE && exit 0
test -z $GITDIR && exit 0
while read oldrev newrev ref
do
branch=${ref#refs/heads/*}
git --work-tree=$WORKTREE --git-dir=$GITDIR checkout -f $branch \
&& pushd $WORKTREE \
&& make check \
&& popd
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment