Skip to content

Instantly share code, notes, and snippets.

@ishaq
Created June 10, 2014 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ishaq/167ef4940f8615f5ac19 to your computer and use it in GitHub Desktop.
Save ishaq/167ef4940f8615f5ac19 to your computer and use it in GitHub Desktop.
This script stops the build if git repository has uncommitted changes, useful when archiving because it makes sure releases (Archives) are created from a clean tree. Put this script in a target (say ArchiveHousekeeper) and update target scheme's Build section to add ArchiveHousekeeper as dependency for Archive operation.
#!/bin/sh
if [ -z "$(git status --porcelain)" ]; then
echo "Working directory clean, proceding to Archive"
exit 0
else
echo "error: Working directory dirty, stopping build"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment