/** * Set the list mode * * @param listMode * optional: corresponds to the -r/-a options; by default, only * local branches will be listed * @return this instance */ public ListBranchCommand setListMode(ListMode listMode) { checkCallable(); this.listMode = listMode; return this; }
/** * If this is set, only the branches that contain the specified commit-ish * as an ancestor are returned. * * @param containsCommitish * a commit ID or ref name * @return this instance * @since 3.4 */ public ListBranchCommand setContains(String containsCommitish) { checkCallable(); this.containsCommitish = containsCommitish; return this; } }
checkCallable(); List<Ref> resultRefs; try {
/** * @param listMode * optional: corresponds to the -r/-a options; by default, only * local branches will be listed * @return this instance */ public ListBranchCommand setListMode(ListMode listMode) { checkCallable(); this.listMode = listMode; return this; }
/** * Set the list mode * * @param listMode * optional: corresponds to the -r/-a options; by default, only * local branches will be listed * @return this instance */ public ListBranchCommand setListMode(ListMode listMode) { checkCallable(); this.listMode = listMode; return this; }
/** * If this is set, only the branches that contain the specified commit-ish * as an ancestor are returned. * * @param containsCommitish * a commit ID or ref name * @return this instance * @since 3.4 */ public ListBranchCommand setContains(String containsCommitish) { checkCallable(); this.containsCommitish = containsCommitish; return this; } }
/** * If this is set, only the branches that contain the specified commit-ish * as an ancestor are returned. * * @param containsCommitish * a commit ID or ref name * @return this instance * @since 3.4 */ public ListBranchCommand setContains(String containsCommitish) { checkCallable(); this.containsCommitish = containsCommitish; return this; }
public List<Ref> call() throws GitAPIException { checkCallable(); List<Ref> resultRefs; try { Collection<Ref> refs = new ArrayList<Ref>(); // Also return HEAD if it's detached Ref head = repo.exactRef(Constants.HEAD); if (head != null && head.getLeaf().getName().equals(Constants.HEAD)) refs.add(head); if (listMode == null) { refs.addAll(getRefs(Constants.R_HEADS)); } else if (listMode == ListMode.REMOTE) { refs.addAll(getRefs(Constants.R_REMOTES)); } else { refs.addAll(getRefs(Constants.R_HEADS)); refs.addAll(getRefs(Constants.R_REMOTES)); } resultRefs = new ArrayList<Ref>(filterRefs(refs)); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } Collections.sort(resultRefs, new Comparator<Ref>() { public int compare(Ref o1, Ref o2) { return o1.getName().compareTo(o2.getName()); } }); setCallable(false); return resultRefs; }
checkCallable(); List<Ref> resultRefs; try {