CallSpecification spec,
DocumentWriter writer ) throws GitAPIException {
Set<String> remoteBranchPrefixes = remoteBranchPrefixes();
if (remoteBranchPrefixes.isEmpty()) {
// Generate the child references to the LOCAL branches, which will be sorted by name ...
ListBranchCommand command = git.branchList();
List<Ref> branches = command.call();
// Reverse the sort of the branch names, since they might be version numbers ...
Collections.sort(branches, REVERSE_REF_COMPARATOR);
for (Ref ref : branches) {
String name = ref.getName();
writer.addChild(spec.childId(name), name);
}
return;
}
// There is at least one REMOTE branch, so generate the child references to the REMOTE branches,
// which will be sorted by name (by the command)...
ListBranchCommand command = git.branchList();
command.setListMode(ListMode.REMOTE);
List<Ref> branches = command.call();
// Reverse the sort of the branch names, since they might be version numbers ...
Collections.sort(branches, REVERSE_REF_COMPARATOR);
Set<String> uniqueNames = new HashSet<String>();
for (Ref ref : branches) {
String name = ref.getName();