Skip to content

Commit

Permalink
Merge pull request #51 from fugi/fixRemoteName
Browse files Browse the repository at this point in the history
JENKINS-46624
  • Loading branch information
klimas7 committed Sep 3, 2017
2 parents 144d11a + 8983760 commit def2346
Showing 1 changed file with 3 additions and 4 deletions.
Expand Up @@ -289,7 +289,7 @@ public Map<String, String> generateContents(JobWrapper jobWrapper, GitSCM git) {
}

if (isBranchType()) {
Set<String> branchSet = getBranch(gitClient, gitUrl);
Set<String> branchSet = getBranch(gitClient, gitUrl, repository.getName());
sortAndPutToParam(branchSet, paramList);
}

Expand All @@ -302,7 +302,6 @@ public Map<String, String> generateContents(JobWrapper jobWrapper, GitSCM git) {
sortAndPutToParam(pullRequestSet, paramList);
}
}
break;
}
}
} catch (Exception e) {
Expand Down Expand Up @@ -343,14 +342,14 @@ private Set<String> getTag(GitClient gitClient, String gitUrl) throws Interrupte
return tagSet;
}

private Set<String> getBranch(GitClient gitClient, String gitUrl) throws InterruptedException {
private Set<String> getBranch(GitClient gitClient, String gitUrl, String remoteName) throws InterruptedException {
Set<String> branchSet = new HashSet<String>();
Pattern branchFilterPattern = compileBranchFilterPattern();

Map<String, ObjectId> branches = gitClient.getRemoteReferences(gitUrl, null, true, false);
Iterator<String> remoteBranchesName = branches.keySet().iterator();
while (remoteBranchesName.hasNext()) {
String branchName = strip(remoteBranchesName.next(), DEFAULT_REMOTE);
String branchName = strip(remoteBranchesName.next(), remoteName);
Matcher matcher = branchFilterPattern.matcher(branchName);
if (matcher.matches()) {
if (matcher.groupCount() == 1) {
Expand Down

0 comments on commit def2346

Please sign in to comment.