pre-commit.sh 254 B

12345678910111213141516
  1. #!/bin/bash
  2. STASH_NAME="pre-commit-$(date +%s)"
  3. git stash save -q --keep-index $STASH_NAME
  4. # Test prospective commit
  5. ./utils/run_tests.sh
  6. result=$?
  7. STASHES=$(git stash list)
  8. if [[ $STASHES == "$STASH_NAME" ]]; then
  9. git stash pop -q
  10. fi
  11. exit $result