Package org.eclipse.jgit.api
Class SubmoduleAddCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<T>
-
- org.eclipse.jgit.api.TransportCommand<SubmoduleAddCommand,Repository>
-
- org.eclipse.jgit.api.SubmoduleAddCommand
-
- All Implemented Interfaces:
java.util.concurrent.Callable<Repository>
public class SubmoduleAddCommand extends TransportCommand<SubmoduleAddCommand,Repository>
A class used to execute a submodule add command. This will clone the configured submodule, register the submodule in the .gitmodules file and the repository config file, and also add the submodule and .gitmodules file to the index.- See Also:
- Git documentation about submodules
-
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.api.TransportCommand
credentialsProvider, timeout, transportConfigCallback
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Constructor Description SubmoduleAddCommand(Repository repo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Repository
call()
Executes theSubmoduleAddCommand
TheRepository
instance returned by this command needs to be closed by the caller to free resources held by theRepository
instance.SubmoduleAddCommand
setPath(java.lang.String path)
Set repository-relative path of submoduleSubmoduleAddCommand
setProgressMonitor(ProgressMonitor monitor)
The progress monitor associated with the clone operation.SubmoduleAddCommand
setURI(java.lang.String uri)
Set URI to clone submodule fromprotected boolean
submoduleExists()
Is the configured already a submodule in the index?-
Methods inherited from class org.eclipse.jgit.api.TransportCommand
configure, configure, self, setCredentialsProvider, setTimeout, setTransportConfigCallback
-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Constructor Detail
-
SubmoduleAddCommand
public SubmoduleAddCommand(Repository repo)
- Parameters:
repo
-
-
-
Method Detail
-
setPath
public SubmoduleAddCommand setPath(java.lang.String path)
Set repository-relative path of submodule- Parameters:
path
- (with/
as separator)- Returns:
- this command
-
setURI
public SubmoduleAddCommand setURI(java.lang.String uri)
Set URI to clone submodule from- Parameters:
uri
-- Returns:
- this command
-
setProgressMonitor
public SubmoduleAddCommand setProgressMonitor(ProgressMonitor monitor)
The progress monitor associated with the clone operation. By default, this is set toNullProgressMonitor
- Parameters:
monitor
-- Returns:
- this command
- See Also:
NullProgressMonitor
-
submoduleExists
protected boolean submoduleExists() throws java.io.IOException
Is the configured already a submodule in the index?- Returns:
- true if submodule exists in index, false otherwise
- Throws:
java.io.IOException
-
call
public Repository call() throws GitAPIException
Executes theSubmoduleAddCommand
TheRepository
instance returned by this command needs to be closed by the caller to free resources held by theRepository
instance. It is recommended to call this method as soon as you don't need a reference to thisRepository
instance anymore.- Specified by:
call
in interfacejava.util.concurrent.Callable<Repository>
- Specified by:
call
in classGitCommand<Repository>
- Returns:
- the newly created
Repository
- Throws:
GitAPIException
-
-