Skip to content

Instantly share code, notes, and snippets.

@leaysgur
Last active August 29, 2015 14:07
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 leaysgur/bf897e0ad632bf9fd21a to your computer and use it in GitHub Desktop.
Save leaysgur/bf897e0ad632bf9fd21a to your computer and use it in GitHub Desktop.
奇数サイズの画像があればコミットできないようにするフック
# ---------------------------------------------------------------------
# 奇数サイズの画像があればコミットできないようにするフック
#
# 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