jenkinsci/git-plugin — pull request #260 by pbaranchikov (2014-10-16 10:58:05+00:00)
Title: Fixed multibranch pulling with exclusions

Incorrect behavior is detected when the job has excluded paths and is aimed to track multiple branches. Consider the following:

master: 1+ ---- 3+ -- 4
branch1: \-2+ --------- 5

Commits suffixed with "+" are commits with some paths that are not excluded, so the build should trigger for them only. Number of commit shows the time it is committed.
In this situation commit 5 causes project build, while 5 is to be ignored.

The cause of the error is that Git plugin uses last build information to get all the new commits to analyze. After commit 5 is pushed, Git plugin checks for the latest build (it is for commit 3) and try to get all the new commits as git log 3..5, which includes commit 2, which is already built.

Suggested pull request fixes the issue by getting last build information dependent on the branch.