pre-commit 184 B

123456789101112131415
  1. #!/bin/sh
  2. git diff-files --quiet
  3. DIRTY=$?
  4. [ $DIRTY -ne 0 ] && git stash -q --keep-index
  5. npm test
  6. RESULT=$?
  7. [ $DIRTY -ne 0 ] && git stash pop -q
  8. [ $RESULT -ne 0 ] && exit 1
  9. exit 0