Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment