Last active
August 29, 2015 14:05
-
-
Save elland/0e3a146d3b63e716157f to your computer and use it in GitHub Desktop.
Pre-Commit Git Hook to remove Reveal.framework references.
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/bash | |
git diff --cached --name-status | while read st file; do | |
# skip deleted files | |
if [ "$st" == 'D' ]; then continue; fi | |
# do a check only on the pbxproj file | |
if [[ "$file" =~ 'project.pbxproj' ]] ; then | |
# Remove references to Reveal.framework | |
sed -i '' -E 'N;s/.*Reveal.*\n(.*)/\1/' "$file" | |
sed -i '' -E 'N;s/(.*)\n.*Reveal.*/\1/' "$file" | |
git add "$file" | |
fi | |
done | |
if git diff --staged --name-only --quiet; then | |
echo "No files to commit after removing Reveal references" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment