public class CloneCommand extends TransportCommand<CloneCommand,Git>
credentialsProvider, timeout, transportConfigCallback
repo
Constructor and Description |
---|
CloneCommand()
Create clone command with no repository set
|
Modifier and Type | Method and Description |
---|---|
Git |
call()
Executes the
Clone command. |
CloneCommand |
setBare(boolean bare) |
CloneCommand |
setBranch(String branch) |
CloneCommand |
setBranchesToClone(Collection<String> branchesToClone) |
CloneCommand |
setCloneAllBranches(boolean cloneAllBranches) |
CloneCommand |
setCloneSubmodules(boolean cloneSubmodules) |
CloneCommand |
setDirectory(File directory)
The optional directory associated with the clone operation.
|
CloneCommand |
setGitDir(File gitDir) |
CloneCommand |
setNoCheckout(boolean noCheckout) |
CloneCommand |
setProgressMonitor(ProgressMonitor monitor)
The progress monitor associated with the clone operation.
|
CloneCommand |
setRemote(String remote)
The remote name used to keep track of the upstream repository for the
clone operation.
|
CloneCommand |
setURI(String uri) |
configure, configure, self, setCredentialsProvider, setTimeout, setTransportConfigCallback
checkCallable, getRepository, setCallable
public Git call() throws GitAPIException, InvalidRemoteException, TransportException
Clone
command.
The Git instance returned by this command needs to be closed by the
caller to free resources held by the underlying Repository
instance. It is recommended to call this method as soon as you don't need
a reference to this Git
instance and the underlying
Repository
instance anymore.call
in interface Callable<Git>
call
in class GitCommand<Git>
Git
object with associated repositoryInvalidRemoteException
TransportException
GitAPIException
public CloneCommand setURI(String uri)
uri
- the URI to clone from, or null
to unset the URI.
The URI must be set before call()
is called.public CloneCommand setDirectory(File directory)
directory
- the directory to clone to, or null
if the directory
name should be taken from the source uriIllegalStateException
- if the combination of directory, gitDir and bare is illegal.
E.g. if for a non-bare repository directory and gitDir point
to the same directory of if for a bare repository both
directory and gitDir are specifiedURIish.getHumanishName()
public CloneCommand setGitDir(File gitDir)
gitDir
- the repository meta directory, or null
to choose one
automatically at clone timeIllegalStateException
- if the combination of directory, gitDir and bare is illegal.
E.g. if for a non-bare repository directory and gitDir point
to the same directory of if for a bare repository both
directory and gitDir are specifiedpublic CloneCommand setBare(boolean bare) throws IllegalStateException
bare
- whether the cloned repository is bare or notIllegalStateException
- if the combination of directory, gitDir and bare is illegal.
E.g. if for a non-bare repository directory and gitDir point
to the same directory of if for a bare repository both
directory and gitDir are specifiedpublic CloneCommand setRemote(String remote)
Constants.DEFAULT_REMOTE_NAME
will be used.remote
- name that keeps track of the upstream repository.
null
means to use DEFAULT_REMOTE_NAME.Constants.DEFAULT_REMOTE_NAME
public CloneCommand setBranch(String branch)
branch
- the initial branch to check out when cloning the repository.
Can be specified as ref name (refs/heads/master
),
branch name (master
) or tag name (v1.2.3
).
The default is to use the branch pointed to by the cloned
repository's HEAD and can be requested by passing null
or HEAD
.public CloneCommand setProgressMonitor(ProgressMonitor monitor)
NullProgressMonitor
monitor
- this
NullProgressMonitor
public CloneCommand setCloneAllBranches(boolean cloneAllBranches)
cloneAllBranches
- true when all branches have to be fetched (indicates wildcard
in created fetch refspec), false otherwise.this
public CloneCommand setCloneSubmodules(boolean cloneSubmodules)
cloneSubmodules
- true to initialize and update submodules. Ignored when
setBare(boolean)
is set to true.this
public CloneCommand setBranchesToClone(Collection<String> branchesToClone)
branchesToClone
- collection of branches to clone. Ignored when allSelected is
true. Must be specified as full ref names (e.g.
refs/heads/master
).this
public CloneCommand setNoCheckout(boolean noCheckout)
noCheckout
- if set to true
no branch will be checked out
after the clone. This enhances performance of the clone
command when there is no need for a checked out branch.this
Copyright © 2018 Eclipse JGit Project. All rights reserved.