mediawiki-extensions-Visual.../bin/pre-commit.sh
James D. Forrester f81ce29bda Add a clean-up script for use as a pre-commit hook
Change-Id: I0e87cbd2d653f4125e2a3d40cda30a3464a7a287
2015-07-03 01:57:03 +00:00

24 lines
559 B
Bash
Executable file

#!/usr/bin/env bash
# If the VE core sub-module was touched
if git diff --quiet --cached lib/ve; then
GITBRANCH=`git rev-parse --abbrev-ref HEAD`;
# … and it doesn't look like
if [[ $GITBRANCH != "sync-repos" ]]; then
echo "VE core sub-module was touched but commit isn't from 'sync-repos'.";
exit 1;
fi
fi
# Stash any uncommited changes
git stash -q --keep-index
npm install || git stash pop -q && exit 1
npm test && git add -u .docs/* || git stash pop -q && exit 1
# Re-apply any uncommited changes
git stash pop -q