public class SubmoduleDeinitCommand extends GitCommand<java.util.Collection<SubmoduleDeinitResult>>
This will remove the module(s) from the working tree, but won't affect .git/modules.
Modifier and Type | Class and Description |
---|---|
static class |
SubmoduleDeinitCommand.NoSuchSubmoduleException
The user tried to deinitialize a submodule that doesn't exist in the
index.
|
static class |
SubmoduleDeinitCommand.SubmoduleDeinitStatus
The effect of a submodule deinit command for a given path
|
Modifier and Type | Field and Description |
---|---|
private boolean |
force |
private java.util.Collection<java.lang.String> |
paths |
repo
Constructor and Description |
---|
SubmoduleDeinitCommand(Repository repo)
Constructor of SubmoduleDeinitCommand
|
Modifier and Type | Method and Description |
---|---|
SubmoduleDeinitCommand |
addPath(java.lang.String path)
Add repository-relative submodule path to deinitialize
|
java.util.Collection<SubmoduleDeinitResult> |
call() |
private SubmoduleDeinitCommand.SubmoduleDeinitStatus |
checkDirty(RevWalk revWalk,
java.lang.String path)
Check if a submodule is dirty.
|
private void |
deinit(java.lang.String path)
Recursively delete the *contents* of path, but leave path as an empty
directory
|
SubmoduleDeinitCommand |
setForce(boolean force)
If
true , call() will deinitialize modules with local changes;
else it will refuse to do so. |
private boolean |
submoduleExists(java.lang.String path)
Check if this path is a submodule by checking the index, which is what
git submodule deinit checks.
|
checkCallable, getRepository, setCallable
private final java.util.Collection<java.lang.String> paths
private boolean force
public SubmoduleDeinitCommand(Repository repo)
repo
- public java.util.Collection<SubmoduleDeinitResult> call() throws GitAPIException
Execute the command
call
in interface java.util.concurrent.Callable<java.util.Collection<SubmoduleDeinitResult>>
call
in class GitCommand<java.util.Collection<SubmoduleDeinitResult>>
SubmoduleDeinitCommand.NoSuchSubmoduleException
- if any of the submodules which we might want to deinitialize
don't existGitAPIException
private void deinit(java.lang.String path) throws java.io.IOException
path
- the path to cleanjava.io.IOException
private SubmoduleDeinitCommand.SubmoduleDeinitStatus checkDirty(RevWalk revWalk, java.lang.String path) throws GitAPIException, java.io.IOException
revWalk
- path
- GitAPIException
java.io.IOException
private boolean submoduleExists(java.lang.String path) throws java.io.IOException
path
- path of the submoduletrue
if path exists and is a submodule in index,
false
otherwisejava.io.IOException
public SubmoduleDeinitCommand addPath(java.lang.String path)
path
- (with /
as separator)public SubmoduleDeinitCommand setForce(boolean force)
true
, call() will deinitialize modules with local changes;
else it will refuse to do so.force
- this