pre-commit.sh 559 B

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