public class DeleteBranchCommand extends GitCommand<java.util.List<java.lang.String>>
call()
is a list with the (full) names of the deleted
branches.
Note that we don't have a setter corresponding to the -r option; remote
tracking branches are simply deleted just like local branches.Modifier and Type | Field and Description |
---|---|
private java.util.Set<java.lang.String> |
branchNames |
private boolean |
force |
repo
Modifier | Constructor and Description |
---|---|
protected |
DeleteBranchCommand(Repository repo)
Constructor for DeleteBranchCommand
|
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
call() |
DeleteBranchCommand |
setBranchNames(java.lang.String... branchnames)
Set the names of the branches to delete
|
DeleteBranchCommand |
setForce(boolean force)
Set whether to forcefully delete branches
|
checkCallable, getRepository, setCallable
private final java.util.Set<java.lang.String> branchNames
private boolean force
protected DeleteBranchCommand(Repository repo)
repo
- the Repository
public java.util.List<java.lang.String> call() throws GitAPIException, NotMergedException, CannotDeleteCurrentBranchException
Execute the command
call
in interface java.util.concurrent.Callable<java.util.List<java.lang.String>>
call
in class GitCommand<java.util.List<java.lang.String>>
GitAPIException
NotMergedException
CannotDeleteCurrentBranchException
public DeleteBranchCommand setBranchNames(java.lang.String... branchnames)
branchnames
- the names of the branches to delete; if not set, this will do
nothing; invalid branch names will simply be ignoredpublic DeleteBranchCommand setForce(boolean force)
force
- true
corresponds to the -D option,
false
to the -d option (default) false
a check will be performed whether the
branch to be deleted is already merged into the current branch
and deletion will be refused in this case