@Signature public Memory branchList(ArrayMemory settings) throws GitAPIException { ListBranchCommand command = getWrappedObject().branchList(); if (settings != null) { Memory listMode = settings.valueOfIndex("listMode"); if (listMode.isNotNull()) { command.setListMode(ListBranchCommand.ListMode.valueOf(listMode.toString())); } Memory contains = settings.valueOfIndex("contains"); if (contains.isNotNull()) { command.setContains(contains.toString()); } } return GitUtils.valueOfRefs(command.call()); }
private Set<String> getBranches(Git git, String hash) throws GitAPIException { if(!collectConfig.isCollectingBranches()) return new HashSet<>(); List<Ref> gitBranches = git.branchList().setContains(hash).call(); Set<String> mappedBranches = gitBranches.stream() .map( (ref) -> ref.getName().substring(ref.getName().lastIndexOf("/") + 1)) .collect(Collectors.toSet()); return mappedBranches; }
command.setContains(containsCommitish);