Created
April 8, 2013 05:59
-
-
Save a-suenami/5334544 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
#!/bin/sh | |
files=`git diff --cached --name-only` | |
assets_path=`git config assets.path` | |
[ -z "$assets_path" ] && exit 0 | |
for file in $files | |
do | |
if [[ "$file" =~ "^$assets_path" ]]; then | |
exec < /dev/tty | |
read -p "Assets version configuration updated ? [y/n]" updated | |
if [ "$updated" = "y" -o "$updated" = "yes" ]; then | |
exit 0 | |
else | |
exit 1 | |
fi | |
fi | |
done |
assetsのバージョン管理だけじゃなくて、任意のパス以下に差分があったときに任意のメッセージを出すというフックにすれば汎用的でもう少し使い道広がるかも。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
.git/config
に以下の設定が必要。