Package org.eclipse.jgit.api
Class ListBranchCommand
Used to obtain a list of branches.
In case HEAD is detached (it points directly to a commit), it is also returned in the results.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe modes available for listing branches (corresponding to the -r and -a options) -
Field Summary
FieldsFields inherited from class org.eclipse.jgit.api.GitCommand
repo -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedListBranchCommand(Repository repo) Constructor for ListBranchCommand. -
Method Summary
Modifier and TypeMethodDescriptioncall()private Collection<Ref>filterRefs(Collection<Ref> refs) setContains(String containsCommitish) If this is set, only the branches that contain the specified commit-ish as an ancestor are returned.setListMode(ListBranchCommand.ListMode listMode) Set the list modeMethods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Field Details
-
listMode
-
containsCommitish
-
-
Constructor Details
-
ListBranchCommand
Constructor for ListBranchCommand.- Parameters:
repo- aRepositoryobject.
-
-
Method Details
-
call
Execute the command
- Specified by:
callin interfaceCallable<List<Ref>>- Specified by:
callin classGitCommand<List<Ref>>- Throws:
GitAPIException
-
filterRefs
- Throws:
RefNotFoundExceptionIOException
-
setListMode
Set the list mode- Parameters:
listMode- optional: corresponds to the -r/-a options; by default, only local branches will be listed- Returns:
- this instance
-
setContains
If this is set, only the branches that contain the specified commit-ish as an ancestor are returned.- Parameters:
containsCommitish- a commit ID or ref name- Returns:
- this instance
- Since:
- 3.4
-