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);