Skip to content

Commit 78813d4

Browse files
committed
When the list of candidates is empty use the previous implementation.
1 parent 76cb14e commit 78813d4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ public Collection<Revision> getCandidateRevisions(boolean isPollCall, String sin
104104
revision.getBranches().add(new Branch(singleBranch, sha1));
105105
candidateRevs.add(revision);
106106
}
107+
// fallback to return given sha1 if the list of candidate revisions is empty
108+
if (candidateRevs.isEmpty()) {
109+
Revision revision = new Revision(sha1);
110+
revision.getBranches().add(new Branch(singleBranch, sha1));
111+
return Collections.singletonList(revision);
112+
}
107113
return candidateRevs;
108114
} catch (GitException e) {
109115
// branch does not exist, there is nothing to build

0 commit comments

Comments
 (0)