Permalink
Browse files

Use proper count of number of commits we processed for stories.

  • Loading branch information...
1 parent ee27961 commit e4a1aad0222e07e8003b50196c0109dd106ad915 @chris committed Dec 2, 2008
Showing with 14 additions and 2 deletions.
  1. +11 −0 test.rb
  2. +3 −2 tracker_github_hook.rb
View
11 test.rb
@@ -32,6 +32,17 @@
"added": ["filepath.rb"]
},
{
+ "id": "41a212ee83ca321e3c8cf465891cb7216a705f59",
+ "url": "http://github.com/defunkt/github/commit/41a212ee83ca127e3c8cf465891ab7216a705f59",
+ "author": {
+ "email": "chris@cobaltedge.com",
+ "name": "Chris Bailey"
+ },
+ "message": "This one does not have a story association",
+ "timestamp": "2008-02-15T14:58:17-08:00",
+ "added": ["filepath.rb"]
+ },
+ {
"id": "de8251ff97ee194a289832576287d6f8ad74e3d0",
"url": "http://github.com/defunkt/github/commit/de8251ff97ee194a289832576287d6f8ad74e3d0",
"author": {
View
@@ -38,11 +38,11 @@
# The handler for the GitHub post-receive hook
post '/' do
+ @num_commits = 0
push = JSON.parse(params[:payload])
tracker_info = PROJECTS[push['repository']['url']]
push['commits'].each { |commit| process_commit(tracker_info, commit) }
- num_commits = push['commits'].length
- "Processed #{num_commits} commits"
+ "Processed #{@num_commits} commits for stories"
end
@@ -54,6 +54,7 @@ def process_commit(tracker_info, commit)
# see if there is a Tracker story trigger, and if so, get story ID
tracker_trigger = message.match(/\[Story(\d+)(.*)\]/)
if tracker_trigger
+ @num_commits += 1
story_id = tracker_trigger[1]
# post comment to the story

0 comments on commit e4a1aad

Please sign in to comment.