Created
April 1, 2011 08:01
-
-
Save ujh/897867 to your computer and use it in GitHub Desktop.
git commit hook that modifies the commit message to include links to Pivotal Tracker stories when issue number is included
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 | |
PREFIX = "https://www.pivotaltracker.com/story/show/" | |
fn = ARGV.first | |
sids = [] | |
File.open(fn) do |f| | |
f.each do |line| | |
next if line =~ /^#/ | |
line.scan(/\[[^#]*#(\d+)\s*\]/) {|a| sids += a } | |
end | |
end | |
story_links = sids.map {|i| PREFIX + i }.join("\n") | |
msg = File.read(fn) + "\n" + story_links | |
File.open(fn, 'w') {|f| f.puts msg } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment