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

public Class SubmoduleDeinitCommand

extends GitCommand<Collection<SubmoduleDeinitResult>>
Class Inheritance
Static Imports
org.eclipse.jgit.util.FileUtils.RECURSIVE

A class used to execute a submodule deinit command.

This will remove the module(s) from the working tree, but won't affect .git/modules.

Since
4.10
See Also
Git documentation about submodules

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
SubmoduleDeinitCommand.NoSuchSubmoduleException

The user tried to deinitialize a submodule that doesn't exist in the index.

public static enum
SubmoduleDeinitCommand.SubmoduleDeinitStatus

The effect of a submodule deinit command for a given path

Field Summary

Modifier and TypeField and Description
private boolean
private final Collection<String>
Inherited from org.eclipse.jgit.api.GitCommand:
repo

Constructor Summary

AccessConstructor and Description
public
SubmoduleDeinitCommand(Repository
repository this command works on
repo
)

Constructor of SubmoduleDeinitCommand

Method Summary

Modifier and TypeMethod and Description
public SubmoduleDeinitCommand

Returns:

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

Add repository-relative submodule path to deinitialize

public Collection<SubmoduleDeinitResult>

Returns:

the set of repositories successfully deinitialized.
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.

private SubmoduleDeinitCommand.SubmoduleDeinitStatus

Returns:

status of the command
checkDirty
(RevWalk
used to walk commit graph
revWalk
,
String
path of the submodule
path
)

Check if a submodule is dirty.

private void
deinit(String
the path to clean
path
)

Recursively delete the *contents* of path, but leave path as an empty directory

public SubmoduleDeinitCommand

Returns:

this
setForce
(boolean
execute the command forcefully if there are local modifications
force
)

If true, call() will deinitialize modules with local changes; else it will refuse to do so.

private boolean

Returns:

true if path exists and is a submodule in index, false otherwise
submoduleExists
(String
path of the submodule
path
)

Check if this path is a submodule by checking the index, which is what git submodule deinit checks.

Inherited from org.eclipse.jgit.api.GitCommand:
checkCallablegetRepositorysetCallable

Field Detail

forceback to summary
private boolean force
pathsback to summary
private final Collection<String> paths

Constructor Detail

SubmoduleDeinitCommandback to summary
public SubmoduleDeinitCommand(Repository repo)

Constructor of SubmoduleDeinitCommand

Parameters
repo:Repository

repository this command works on

Method Detail

addPathback to summary
public SubmoduleDeinitCommand addPath(String path)

Add repository-relative submodule path to deinitialize

Parameters
path:String

(with / as separator)

Returns:SubmoduleDeinitCommand

this command

callback to summary
public Collection<SubmoduleDeinitResult> 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

Returns:Collection<SubmoduleDeinitResult>

the set of repositories successfully deinitialized.

Annotations
@Override
Exceptions
NoSuchSubmoduleException:
if any of the submodules which we might want to deinitialize don't exist
checkDirtyback to summary
private SubmoduleDeinitCommand.SubmoduleDeinitStatus checkDirty(RevWalk revWalk, String path) throws GitAPIException, IOException

Check if a submodule is dirty. A submodule is dirty if there are local changes to the submodule relative to its HEAD, including untracked files. It is also dirty if the HEAD of the submodule does not match the value in the parent repo's index or HEAD.

Parameters
revWalk:RevWalk

used to walk commit graph

path:String

path of the submodule

Returns:SubmoduleDeinitCommand.SubmoduleDeinitStatus

status of the command

Exceptions
GitAPIException:
if JGit API failed
IOException:
if an IO error occurred
deinitback to summary
private void deinit(String path) throws IOException

Recursively delete the *contents* of path, but leave path as an empty directory

Parameters
path:String

the path to clean

Exceptions
IOException:
if an IO error occurred
setForceback to summary
public SubmoduleDeinitCommand setForce(boolean force)

If true, call() will deinitialize modules with local changes; else it will refuse to do so.

Parameters
force:boolean

execute the command forcefully if there are local modifications

Returns:SubmoduleDeinitCommand

this

submoduleExistsback to summary
private boolean submoduleExists(String path) throws IOException

Check if this path is a submodule by checking the index, which is what git submodule deinit checks.

Parameters
path:String

path of the submodule

Returns:boolean

true if path exists and is a submodule in index, false otherwise

Exceptions
IOException:
if an IO error occurred
org.eclipse.jgit.api back to summary

public Class SubmoduleDeinitCommand.NoSuchSubmoduleException

extends GitAPIException
Class Inheritance

The user tried to deinitialize a submodule that doesn't exist in the index.

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
public
NoSuchSubmoduleException(String
path of non-existing submodule
path
)

Constructor of NoSuchSubmoduleException

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.eclipse.jgit.api.errors.GitAPIException.serialVersionUID.

Constructor Detail

NoSuchSubmoduleExceptionback to summary
public NoSuchSubmoduleException(String path)

Constructor of NoSuchSubmoduleException

Parameters
path:String

path of non-existing submodule

org.eclipse.jgit.api back to summary

public final Enum SubmoduleDeinitCommand.SubmoduleDeinitStatus

extends Enum<SubmoduleDeinitCommand.SubmoduleDeinitStatus>
Class Inheritance

The effect of a submodule deinit command for a given path

Field Summary

Modifier and TypeField and Description
public static final SubmoduleDeinitCommand.SubmoduleDeinitStatus
ALREADY_DEINITIALIZED

The submodule was not initialized in the first place

public static final SubmoduleDeinitCommand.SubmoduleDeinitStatus
DIRTY

The submodule had local changes and force was false

public static final SubmoduleDeinitCommand.SubmoduleDeinitStatus
FORCED

The submodule had local changes, but was deinitialized successfully

public static final SubmoduleDeinitCommand.SubmoduleDeinitStatus
SUCCESS

The submodule was deinitialized

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static SubmoduleDeinitCommand.SubmoduleDeinitStatus
public static SubmoduleDeinitCommand.SubmoduleDeinitStatus[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ALREADY_DEINITIALIZEDback to summary
public static final SubmoduleDeinitCommand.SubmoduleDeinitStatus ALREADY_DEINITIALIZED

The submodule was not initialized in the first place

DIRTYback to summary
public static final SubmoduleDeinitCommand.SubmoduleDeinitStatus DIRTY

The submodule had local changes and force was false

FORCEDback to summary
public static final SubmoduleDeinitCommand.SubmoduleDeinitStatus FORCED

The submodule had local changes, but was deinitialized successfully

SUCCESSback to summary
public static final SubmoduleDeinitCommand.SubmoduleDeinitStatus SUCCESS

The submodule was deinitialized

Constructor Detail

SubmoduleDeinitStatusback to summary
private SubmoduleDeinitStatus()

Method Detail

valueOfback to summary
public static SubmoduleDeinitCommand.SubmoduleDeinitStatus valueOf(String name)
valuesback to summary
public static SubmoduleDeinitCommand.SubmoduleDeinitStatus[] values()