Created
October 24, 2015 09:14
-
-
Save Slowhand0309/2479224835c16a81de89 to your computer and use it in GitHub Desktop.
git-hooks update for print info by push
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
#!/usr/bin/env ruby | |
refname = ARGV[0] | |
oldrev = ARGV[1] | |
newrev = ARGV[2] | |
puts "push info >> \n(#{refname}) (#{oldrev[0,6]}) (#{newrev[0,6]})" | |
sharevs = `git rev-list #{oldrev[0,6]}..#{newrev[0,6]}`.split("\n") | |
sharevs.each do |rev| | |
message = `git cat-file commit #{rev} | sed '1,/^$/d'` | |
committer = "?" | |
messages = `git cat-file commit #{rev}`.split("\n") | |
messages.each do |msg| | |
committer = msg if msg.include?("committer") | |
end | |
puts committer | |
puts message | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment