Skip to content

Instantly share code, notes, and snippets.

@morimori
Created September 10, 2012 03:59
Show Gist options
  • Save morimori/3688802 to your computer and use it in GitHub Desktop.
Save morimori/3688802 to your computer and use it in GitHub Desktop.
focus タグや save_and_open_page が残っていたらコミットさせない pre-commit フック
# Block commit include focus tag for test
git stash --keep-index -q
FOCUS_TAGS=$(grep -rn ':focus => true' spec/*/**)
result=$?
git stash pop -q
if [ $result -eq 0 ]; then
echo "### PLEASE REMOVE FOCUS TAGS ###"
echo "$FOCUS_TAGS"
exit 1
fi
# Block commit include focus tag for test
git stash --keep-index -q
SAVE_AND_OPEN_PAGE=$(grep -rn 'save_and_open_page' spec/*/**)
result=$?
git stash pop -q
if [ $result -eq 0 ]; then
echo "### PLEASE REMOVE save_and_open_page ###"
echo "$SAVE_AND_OPEN_PAGE"
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment