Created
October 6, 2009 08:34
-
-
Save co3k/202866 to your computer and use it in GitHub Desktop.
git コミット時にチケット番号の記述を強制する奴
This file contains hidden or 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 | |
if grep "\(refs\|fixes\) #[0-9]\+" $1 > /dev/null; then | |
ticket=$(sed -e "s/.*\(fixes\|refs\) #\([0-9]\+\).*/\2/" .git/COMMIT_EDITMSG | line) | |
title=$(curl -s "http://redmine.openpne.jp/issues/$ticket" | sed -n "/<title>/p" | sed "s/<title>\(.\+\)<\/title>/\1/") | |
if [ "404 - OpenPNE Issue Tracking System" = "$title" ]; then | |
echo "The specified ticket #$ticket is undefined." | |
exit 1 | |
fi | |
echo "This commit will be related to:" | |
if [ "" != "$title" ]; then | |
echo $title | |
else | |
echo "#$ticket" | |
fi | |
exit 0 | |
else | |
echo "This commit isn't related to any tickets." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment