Skip to content

Commit

Permalink
[FIXES JENKINS-14321] - Do not re-use last build's environment for re…
Browse files Browse the repository at this point in the history
…mote polling

Fixes, the original 'fix' in 3d9a73d it appears
that a crucial check on the newly implemented argument wasn't actually implemented.

I've changed the condition to test this rather than set 'b' to null if reuseLastBuildEnv
is set to true as 'b' is de-referenced later in the getPollEnvironment method.

Rather worryingly it appears that the existing code in getPollEnvironment tests at one
point whether 'b' is null, but then later (outside this test) derefences it anyway, but
this commit does not make that particular problem any worse.

Signed-off-by: ciaranj <ciaranj@gmail.com>
  • Loading branch information
ciaranj authored and ciaranj committed Jan 4, 2013
1 parent 4817492 commit df304f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/git/util/GitUtils.java
Expand Up @@ -187,7 +187,7 @@ public static EnvVars getPollEnvironment(AbstractProject p, FilePath ws, Launche
StreamBuildListener buildListener = new StreamBuildListener((OutputStream)listener.getLogger());
AbstractBuild b = (AbstractBuild)p.getLastBuild();

if (b != null) {
if (reuseLastBuildEnv && b != null) {
Node lastBuiltOn = b.getBuiltOn();

if (lastBuiltOn != null) {
Expand Down

0 comments on commit df304f7

Please sign in to comment.