typesafehub/ghpullrequest-validator — pull request #27 by adriaanm (2013-03-12 07:04:50+00:00)
Title: better commit status reordering

We want to ensure that a PR is only shown as ok on github if all commits and all jobs are actually ok.

Unfortunately, GitHub only looks at the most recent status of the last commit of the PR to determine the status of the whole PR.

As we can only prepend new statuses to a commit while having to support multiple jobs per commit and multiple commits per PR, we implement the following strategy to implement the desired behaviour.
- For every commit, we copy error/pending jobs that have no corresponding success to the head of the list.
- For the last commit, we add a fake pending status if there are earlier commits that meet the above condition (having an error/pending status without corresponding success).