Skip to content

Commit

Permalink
sort commits from github by timestamp, since they don't seem to alway…
Browse files Browse the repository at this point in the history
…s provide them in order, and the last commit should be built last, given that its status is the project's status
  • Loading branch information
jamesgolick committed Dec 3, 2008
1 parent 140578e commit c196c39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
payload = JSON.parse(params[:payload] || "")

if Integrity.config[:build_all_commits]
payload['commits'].reverse.each do |commit|
payload['commits'].sort_by { |commit| Time.parse(commit['timestamp']) }.each do |commit|
current_project.build(commit['id']) if payload['ref'] =~ /#{current_project.branch}/
end
else
Expand Down
6 changes: 3 additions & 3 deletions spec/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,9 @@ def payload
status.should == 404
end

it 'should make a new build for each commit' do
@project.should_receive(:build).with('41a212ee83ca127e3c8cf465891ab7216a705f59')
@project.should_receive(:build).with('de8251ff97ee194a289832576287d6f8ad74e3d0')
it 'should make a new build for each commit in ascending order of their dates' do
@project.should_receive(:build).with('de8251ff97ee194a289832576287d6f8ad74e3d0').ordered
@project.should_receive(:build).with('41a212ee83ca127e3c8cf465891ab7216a705f59').ordered
post_it '/github/push', :payload => payload
end

Expand Down

0 comments on commit c196c39

Please sign in to comment.