Top Description Fields Constructors Methods
org.eclipse.jgit.api

public Class SubmoduleAddCommand

extends TransportCommand<SubmoduleAddCommand, Repository>
Class Inheritance
Imports
java.io.File, .IOException, java.text.MessageFormat, org.eclipse.jgit.api.errors.GitAPIException, .JGitInternalException, .NoFilepatternException, org.eclipse.jgit.errors.ConfigInvalidException, org.eclipse.jgit.internal.JGitText, org.eclipse.jgit.internal.submodule.SubmoduleValidator, org.eclipse.jgit.lib.ConfigConstants, .Constants, .NullProgressMonitor, .ProgressMonitor, .Repository, .StoredConfig, org.eclipse.jgit.storage.file.FileBasedConfig, org.eclipse.jgit.submodule.SubmoduleWalk, org.eclipse.jgit.treewalk.filter.PathFilter, .TreeFilter

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

Modifier and TypeField and Description
private ProgressMonitor
private String
private String
private String
Inherited from org.eclipse.jgit.api.TransportCommand:
credentialsProvidertimeouttransportConfigCallback

Constructor Summary

AccessConstructor and Description
public
SubmoduleAddCommand(Repository repo)

Constructor for SubmoduleAddCommand.

Method Summary

Modifier and TypeMethod and Description
public Repository
call()

Implements abstract org.eclipse.jgit.api.GitCommand.call.

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

public SubmoduleAddCommand

Returns:

this command
setName
(String
name of the submodule
name
)

Set the submodule name

public SubmoduleAddCommand

Returns:

this command
setPath
(String
(with / as separator)
path
)

Set repository-relative path of submodule

public SubmoduleAddCommand

Returns:

this command
setProgressMonitor
(ProgressMonitor monitor)

The progress monitor associated with the clone operation.

public SubmoduleAddCommand

Returns:

this command
setURI
(String uri)

Set URI to clone submodule from

protected boolean

Returns:

true if submodule exists in index, false otherwise
submoduleExists
()

Is the configured already a submodule in the index?

Inherited from org.eclipse.jgit.api.TransportCommand:
configureconfigureselfsetCredentialsProvidersetTimeoutsetTransportConfigCallback

Field Detail

monitorback to summary
private ProgressMonitor monitor
nameback to summary
private String name
pathback to summary
private String path
uriback to summary
private String uri

Constructor Detail

SubmoduleAddCommandback to summary
public SubmoduleAddCommand(Repository repo)

Constructor for SubmoduleAddCommand.

Parameters
repo:Repository

a org.eclipse.jgit.lib.Repository object.

Method Detail

callback to summary
public Repository call() throws GitAPIException

Implements abstract org.eclipse.jgit.api.GitCommand.call.

Implements java.util.concurrent.Callable.call.

Doc from org.eclipse.jgit.api.GitCommand.call.

Computes a result, or throws an exception if unable to do so.

Execute the command

Executes the SubmoduleAddCommand The Repository instance returned by this command needs to be closed by the caller to free resources held by the Repository instance. It is recommended to call this method as soon as you don't need a reference to this Repository instance anymore.

Returns:Repository

Doc from java.util.concurrent.Callable.call.

computed result

Annotations
@Override
setNameback to summary
public SubmoduleAddCommand setName(String name)

Set the submodule name

Parameters
name:String

name of the submodule

Returns:SubmoduleAddCommand

this command

Since
5.1
setPathback to summary
public SubmoduleAddCommand setPath(String path)

Set repository-relative path of submodule

Parameters
path:String

(with / as separator)

Returns:SubmoduleAddCommand

this command

setProgressMonitorback to summary
public SubmoduleAddCommand setProgressMonitor(ProgressMonitor monitor)

The progress monitor associated with the clone operation. By default, this is set to NullProgressMonitor

Parameters
monitor:ProgressMonitor

a org.eclipse.jgit.lib.ProgressMonitor object.

Returns:SubmoduleAddCommand

this command

See Also
NullProgressMonitor
setURIback to summary
public SubmoduleAddCommand setURI(String uri)

Set URI to clone submodule from

Parameters
uri:String

a java.lang.String object.

Returns:SubmoduleAddCommand

this command

submoduleExistsback to summary
protected boolean submoduleExists() throws IOException

Is the configured already a submodule in the index?

Returns:boolean

true if submodule exists in index, false otherwise

Exceptions
IOException:
if an IO error occurred