gitignore-test 790 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. set -eu -o pipefail
  3. # Intended to be run after a build. Returns 1 (i.e. failure) if there's at
  4. # least one modified or untracked file which is not gitignored.
  5. # Don't inline it in the if, since we want to exit on error return codes (set -e).
  6. status="$(git status --porcelain)"
  7. if [ -z "$status" ]; then
  8. echo "No not-gitignored changes :]"
  9. exit 0
  10. fi
  11. echo "================================================================================"
  12. echo " ERROR: Files modified by build, but not gitignored:"
  13. echo "--------------------------------------------------------------------------------"
  14. echo "$status"
  15. git submodule foreach --recursive git status --porcelain
  16. echo "================================================================================"
  17. exit 1