Skip to content

Instantly share code, notes, and snippets.

@a-suenami
Created April 8, 2013 05:59
Show Gist options
  • Save a-suenami/5334544 to your computer and use it in GitHub Desktop.
Save a-suenami/5334544 to your computer and use it in GitHub Desktop.
特定ディレクトリ以下の変更があった際にアラートを出すコミット前フック。
#!/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
@a-suenami
Copy link
Author

assetsのバージョン管理だけじゃなくて、任意のパス以下に差分があったときに任意のメッセージを出すというフックにすれば汎用的でもう少し使い道広がるかも。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment