Guest User

Untitled

a guest
Feb 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. post-commit:
  2.  
  3. #!/usr/bin/ruby
  4.  
  5. lastlog = `git log -1`
  6. raise "Error in git log -1" if $?.exitstatus != 0
  7. if lastlog.include?("fix") and not lastlog.include?("closebug")
  8. `echo bug >> bug`
  9. raise "Error in echo" if $?.exitstatus != 0
  10. `git add bug`
  11. raise "Error in git add bug" if $?.exitstatus != 0
  12. `git commit -m closebug`
  13. raise "Error in git commit -m closebug" if $?.exitstatus != 0
  14. end
  15.  
  16. --- end of post-commit
  17.  
  18. mkdir test;
  19. cd test;
  20. git init;
  21. chmod 755 ../post-commit;
  22. cp ../post-commit .git/hooks/post-commit;
  23.  
  24. echo foo >> foo
  25. git add foo
  26. git commit -m 'foo'
  27.  
  28. echo foo >> foo
  29. git add foo
  30. git commit -m 'fix foo'
  31. git status
  32. # On branch master
  33. #nothing to commit (working directory clean)
  34.  
  35.  
  36. echo foo >> foo
  37. git commit -a -m 'fix foo'
  38. git status
  39. # On branch master
  40. # Changed but not updated:
  41. # (use "git add <file>..." to update what will be committed)
  42. #
  43. # modified: bug
  44. #
  45. #no changes added to commit (use "git add" and/or "git commit -a")
  46.  
  47. git --version
  48. #git version 1.5.3.2
Add Comment
Please, Sign In to add comment