jenkinsci/git-plugin — pull request #238 by dengste (2014-06-26 20:17:41+00:00)
Title: [JENKINS-21464] Save build data before doing checkout.

This should hopefully fix JENKINS-21464 and JENKINS-18588.

The problem is the following: When determineRevisionToBuild finds more
than one candidate for building, it triggers a new build without any quiet
period. If "Execute concurrent builds" is active for this project, Jenkins
will immediately start another build on another slave. However, the Git
plugin will do the checkout before saving its build data, which for bigger
projects can take quite some time, in which case the newly triggered build
will take the *same* revision and yet trigger *another* build. This happens
until either the first build hits the queue because all executors are busy,
or until the first build has finished its checkout and saved the build data.

Fix this by saving the build data immediately after calling
determineRevisionToBuild and also add a quiet period of 10 seconds to the
trigger. While at it, also note in the polling log why this build was
triggered.