Skip to content

Commit

Permalink
[JENKINS-37331] No paragraphs, use commas to sperate
Browse files Browse the repository at this point in the history
  • Loading branch information
MadsNielsen committed Apr 19, 2017
1 parent 8ccee77 commit b80f632
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
13 changes: 8 additions & 5 deletions src/main/java/hudson/plugins/git/GitBranchSpecifierColumn.java
Expand Up @@ -6,6 +6,7 @@
import hudson.scm.SCM;
import hudson.views.ListViewColumnDescriptor;
import java.util.ArrayList;
import java.util.List;
import jenkins.triggers.SCMTriggerItem;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;
Expand All @@ -20,24 +21,26 @@ public class GitBranchSpecifierColumn extends ListViewColumn {
@DataBoundConstructor
public GitBranchSpecifierColumn() { }

public String getBranchSpecifier( final Item item ) {
String branchSpec = "";
public List<String> getBranchSpecifier( final Item item ) {
List<String> branchSpec = new ArrayList<String>();
SCMTriggerItem s = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(item);
if(s != null) {
for(SCM scm : s.getSCMs()) {
if (scm instanceof GitSCM) {
GitSCM gitScm = (GitSCM)scm;
ArrayList<String> branches = new ArrayList<String>();
for(BranchSpec spec : gitScm.getBranches()) {
branches.add(spec.getName());
branchSpec.add(spec.getName());
}
branchSpec = StringUtils.join(branches, " ");
}
}
}
return branchSpec;
}

public String breakOutString(List<String> branches) {
return StringUtils.join(branches, ", ");
}

@Extension
public static class DescriptorImpl extends ListViewColumnDescriptor {

Expand Down
Expand Up @@ -2,8 +2,6 @@
<j:jelly xmlns:j="jelly:core">
<j:set var="branchSpec" value="${it.getBranchSpecifier(job)}"/>
<td data="${branchSpec}">
<j:forEach items="${branchSpec.split(' ')}" var="i">
<p>${i}</p>
</j:forEach>
</td>
${it.breakOutString(branchSpec)}
</td>
</j:jelly>

0 comments on commit b80f632

Please sign in to comment.