Last active
June 30, 2016 07:14
-
-
Save woodnathan/9a49478c5c20d212f5096d4a7ec2e8fd to your computer and use it in GitHub Desktop.
xUnique pre-commit script
This file contains 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 | |
echo "pre-commit xunique script start" | |
while read line | |
do | |
if [[ $line =~ .*project.pbxproj$ ]] | |
then | |
pbxprojPath="$line" | |
[ -e "$pbxprojPath" ] && xunique -c "$pbxprojPath" | |
if [ $? -ne 0 ] | |
then | |
[ -f "$pbxprojPath" ] && git add "$pbxprojPath" | |
echo "Added '$pbxprojPath' to commit" | |
fi | |
fi | |
done < <(git diff --name-only --cached) | |
echo "pre-commit xunique script end" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Heavily inspired by the pre-commit script for https://github.com/neciu/SOCK