jenkinsci/git-plugin — pull request #74 by cormallen (2012-06-21 08:34:17+00:00)
Title: Fix for a race condition in polling and a workaround for bugs in git tree-walking code

The current code considers the last commit when polling. It needs to consider all commits since the last build as otherwise commits that should trigger a rebuild may be overlooked if the last commit is one that is excluded.

In addition, Git's whatchanged and log commands have bugs in: under certain circumstances when asked to dump the commits between a set of revisions it will dump everything going back to the creation of the repository. Git's log command does not suffer from the same problem.

(This bug also shows up with slightly different symptoms with some ff-merge situations).

This set of changes modifies isRevExcluded in GitSCM.java to consider all commits since the last build. In order to make this work, I've also had to add a method to GitAPI to produce a set of changes in the standard manner from a range of revisions.

This method uses git log instead of show, and does the correct thing when tested against some very complex real-world repositories and build rules that were going wrong before. Unfortunately I have not been able to reduce the failures to simple test cases, so I have not been able to add unit tests for these situations (though the code changes pass the existing unit tests)