Files
musiclist-server/pre-commit.sh
2020-06-07 23:44:17 -04:00

22 lines
349 B
Bash
Executable File

#!/bin/sh
set -eu
STASH_NAME="pre-commit-$(date +%s)"
git stash save -q --keep-index $STASH_NAME
[ -d venv/ ] || python -m venv venv
. venv/bin/activate
pip install -r requirements.txt -r requirements-dev.txt
./lint.sh
LINT_RESULT=$?
STASHES=$(git stash list)
if [[ $STASHES == "$STASH_NAME" ]]; then
git stash pop -q
fi
exit $LINT_RESULT