text: public List<Ref> call() throws GitAPIException {checkCallable();List<Ref> resultRefs;try {Collection<Ref> refs = new ArrayList<>();Ref head = repo.exactRef(HEAD);if (head != null && head.getLeaf().getName().equals(HEAD)) {refs.add(head);}if (listMode == null) {refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_HEADS));} else if (listMode == ListMode.REMOTE) {refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_REMOTES));} else {refs.addAll(repo.getRefDatabase().getRefsByPrefix(R_HEADS,R_REMOTES));}resultRefs = new ArrayList<>(filterRefs(refs));} catch (IOException e) {throw new JGitInternalException(e.getMessage(), e);}Collections.sort(resultRefs,(Ref o1, Ref o2) -> o1.getName().compareTo(o2.getName()));setCallable(false);return resultRefs;}