Skip to content

Commit

Permalink
Merge pull request #61 from marc-guenther/master
Browse files Browse the repository at this point in the history
[FIXED JENKINS-10880] check if the workspace is null when fast remote polling is enabled with multiple branches
  • Loading branch information
ndeloof committed Apr 5, 2012
2 parents f9f239a + edf0905 commit 11bef7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/main/java/hudson/plugins/git/GitSCM.java
Expand Up @@ -707,7 +707,9 @@ protected PollingResult compareRemoteRevisionWith(AbstractProject<?, ?> project,
// I'm actually not 100% sure about this, but I'll leave it in for now.
// Update 9/9/2010 - actually, I think this *was* needed, since we weren't doing a better check
// for whether we'd ever been built before. But I'm fixing that right now anyway.
if (!workingDirectory.exists()) {

// JENKINS-10880: workingDirectory can be null
if (workingDirectory == null || !workingDirectory.exists()) {
return PollingResult.BUILD_NOW;
}

Expand Down Expand Up @@ -1706,9 +1708,13 @@ protected FilePath workingDirectory(final FilePath workspace) {
* if no relative target dir is specified. Otherwise, it'll be "workspace/relativeTargetDir".
*
* @param workspace
* @return working directory
* @return working directory or null if workspace is null
*/
protected FilePath workingDirectory(final FilePath workspace, EnvVars environment) {
// JENKINS-10880: workspace can be null
if (workspace == null) {
return null;
}
if (relativeTargetDir == null || relativeTargetDir.length() == 0 || relativeTargetDir.equals(".")) {
return workspace;
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/webapp/help-fastremote.html
@@ -1,3 +1,5 @@
<div>
Use git ls-remote polling mechanism. This will compare latest built commit SHA with remote branch without cloning a local copy of the repo
Use git ls-remote polling mechanism. This will compare the latest built commit SHA with the remote branch without cloning a local copy of the repo.<br><br>
If you want to use this, you can have only one repository with one branch (no wildcards!), and you can not use any excluded regions, excluded users or submodules, otherwise this option will disable itself after save.<br><br>
If this is turned off though, polling will require a workspace and might trigger unwanted builds (see <a href="https://issues.jenkins-ci.org/browse/JENKINS-10131" target="_blank">JENKINS-10131</a>).
</div>

0 comments on commit 11bef7f

Please sign in to comment.