Created
September 17, 2008 16:08
-
-
Save kig/11252 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
post-commit: | |
#!/usr/bin/ruby | |
lastlog = `git log -1` | |
raise "Error in git log -1" if $?.exitstatus != 0 | |
if lastlog.include?("fix") and not lastlog.include?("closebug") | |
`echo bug >> bug` | |
raise "Error in echo" if $?.exitstatus != 0 | |
`git add bug` | |
raise "Error in git add bug" if $?.exitstatus != 0 | |
`git commit -m closebug` | |
raise "Error in git commit -m closebug" if $?.exitstatus != 0 | |
end | |
--- end of post-commit | |
mkdir test; | |
cd test; | |
git init; | |
chmod 755 ../post-commit; | |
cp ../post-commit .git/hooks/post-commit; | |
echo foo >> foo | |
git add foo | |
git commit -m 'foo' | |
echo foo >> foo | |
git add foo | |
git commit -m 'fix foo' | |
git status | |
# On branch master | |
#nothing to commit (working directory clean) | |
echo foo >> foo | |
git commit -a -m 'fix foo' | |
git status | |
# On branch master | |
# Changed but not updated: | |
# (use "git add <file>..." to update what will be committed) | |
# | |
# modified: bug | |
# | |
#no changes added to commit (use "git add" and/or "git commit -a") | |
git --version | |
#git version 1.5.3.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment