Created
October 8, 2014 00:53
-
-
Save pix0r/0022a927ad0ddc7bd685 to your computer and use it in GitHub Desktop.
Pre-commit hook to verify xcode project file has not been converted to XML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PROJFILE=`find . -path \*xcodeproj/project.pbxproj -not -path \*Pods\*` | |
if [ "$PROJFILE" = "" ]; then | |
echo "Unable to locate project file; skipping pre-commit hook" | |
exit 0 | |
fi | |
git stash -q --keep-index | |
file "$PROJFILE" | grep -i xml > /dev/null | |
RESULT=$? | |
git stash pop -q | |
if [ $RESULT -eq 0 ]; then | |
echo "Error: your project file is in XML format. Please re-save in Xcode before committing." | |
exit 1 | |
else | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment