Skip to content

Commit

Permalink
[FIXED JENKINS-46295] Handle the case where the query optimization is…
Browse files Browse the repository at this point in the history
… for a deleted branch
  • Loading branch information
stephenc committed Aug 29, 2017
1 parent 6810318 commit 4998943
Showing 1 changed file with 10 additions and 4 deletions.
Expand Up @@ -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) {
Expand Down

0 comments on commit 4998943

Please sign in to comment.