Last active
August 29, 2015 14:07
-
-
Save leaysgur/bf897e0ad632bf9fd21a to your computer and use it in GitHub Desktop.
奇数サイズの画像があればコミットできないようにするフック
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
# --------------------------------------------------------------------- | |
# 奇数サイズの画像があればコミットできないようにするフック | |
# | |
# git_hooks pre-commmitとして設定 | |
# --------------------------------------------------------------------- | |
#!/bin/sh | |
cmd=`find /path/to/img/dir -name '*.png' | xargs file | awk '{ if ($5%2 || $7%2) print $1 }'` | |
if [[ -n $cmd ]]; then | |
echo '以下の画像のサイズが奇数になってるのでコミットできません' | |
echo $cmd | |
exit 1; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment