Created
August 6, 2010 13:03
-
-
Save whitered/511290 to your computer and use it in GitHub Desktop.
Lucky commit git post-commit hook. Checks your last commit SHA number if it is lucky one (the sum of first 20 digits equals to the sum of last 20 ones).
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 | |
left_sum=$((`git log -1 --format=format:%H | cut -c -20 | sed -e 's/[a-f0-9]/\+0x&/g'`)) | |
right_sum=$((`git log -1 --format=format:%H | cut -c 21- | sed -e 's/[a-f0-9]/\+0x&/g'`)) | |
if [ $left_sum = $right_sum ]; then | |
echo '****************************************' | |
echo '* Congratulations! Lucky commit!!! *' | |
echo '****************************************' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment