Skip to content
Permalink
Browse files
[FIXED JENKINS-46295] Handle the case where the query optimization is…
… for a deleted branch
  • Loading branch information
stephenc committed Aug 29, 2017
1 parent 6810318 commit 49989435e00ac8e74621386daac291a912d17fbd
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java
@@ -1767,11 +1767,17 @@ protected Iterable<GHBranch> create() {
try {
request.checkApiRateLimit();
Set<String> branchNames = request.getRequestedOriginBranchNames();
if (branchNames != null && branchNames.size() == 1) {
String branchName = branchNames.iterator().next();
request.listener().getLogger().format("%n Getting remote branch %s...%n", branchName);
return Collections.singletonList(repo.getBranch(branchName));
if (branchNames != null && branchNames.size() == 1) {
String branchName = branchNames.iterator().next();
request.listener().getLogger().format("%n Getting remote branch %s...%n", branchName);
try {
GHBranch branch = repo.getBranch(branchName);
return Collections.singletonList(branch);
} catch (FileNotFoundException e) {
// branch does not currently exist
return Collections.emptyList();
}
}
request.listener().getLogger().format("%n Getting remote branches...%n");
return repo.getBranches().values();
} catch (IOException | InterruptedException e) {

0 comments on commit 4998943

Please sign in to comment.