Package org.eclipse.jgit.api
Class SubmoduleDeinitCommand
java.lang.Object
org.eclipse.jgit.api.GitCommand<Collection<SubmoduleDeinitResult>>
org.eclipse.jgit.api.SubmoduleDeinitCommand
- All Implemented Interfaces:
Callable<Collection<SubmoduleDeinitResult>>
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
The user tried to deinitialize a submodule that doesn't exist in the index.static enum
The effect of a submodule deinit command for a given path -
Field Summary
FieldsFields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor of SubmoduleDeinitCommand -
Method Summary
Modifier and TypeMethodDescriptionAdd repository-relative submodule path to deinitializecall()
checkDirty
(RevWalk revWalk, String path) Check if a submodule is dirty.private void
Recursively delete the *contents* of path, but leave path as an empty directorysetForce
(boolean force) Iftrue
, call() will deinitialize modules with local changes; else it will refuse to do so.private boolean
submoduleExists
(String path) Check if this path is a submodule by checking the index, which is what git submodule deinit checks.Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Field Details
-
paths
-
force
private boolean force
-
-
Constructor Details
-
SubmoduleDeinitCommand
Constructor of SubmoduleDeinitCommand- Parameters:
repo
-
-
-
Method Details
-
call
Execute the command
- Specified by:
call
in interfaceCallable<Collection<SubmoduleDeinitResult>>
- Specified by:
call
in classGitCommand<Collection<SubmoduleDeinitResult>>
- Returns:
- the set of repositories successfully deinitialized.
- Throws:
SubmoduleDeinitCommand.NoSuchSubmoduleException
- if any of the submodules which we might want to deinitialize don't existGitAPIException
-
deinit
Recursively delete the *contents* of path, but leave path as an empty directory- Parameters:
path
- the path to clean- Throws:
IOException
-
checkDirty
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
-path
-- Returns:
- status of the command
- Throws:
GitAPIException
IOException
-
submoduleExists
Check if this path is a submodule by checking the index, which is what git submodule deinit checks.- Parameters:
path
- path of the submodule- Returns:
true
if path exists and is a submodule in index,false
otherwise- Throws:
IOException
-
addPath
Add repository-relative submodule path to deinitialize- Parameters:
path
- (with/
as separator)- Returns:
- this command
-
setForce
Iftrue
, call() will deinitialize modules with local changes; else it will refuse to do so.- Parameters:
force
-- Returns:
this
-