public class CleanCommand extends GitCommand<java.util.Set<java.lang.String>>
| Modifier and Type | Field and Description |
|---|---|
private boolean |
directories |
private boolean |
dryRun |
private boolean |
force |
private boolean |
ignore |
private java.util.Set<java.lang.String> |
paths |
repo| Modifier | Constructor and Description |
|---|---|
protected |
CleanCommand(Repository repo)
Constructor for CleanCommand
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<java.lang.String> |
call() |
private java.util.Set<java.lang.String> |
cleanPath(java.lang.String path,
java.util.Set<java.lang.String> inFiles)
When dryRun is false, deletes the specified path from disk.
|
private java.util.Set<java.lang.String> |
filterFolders(java.util.Set<java.lang.String> untracked,
java.util.Set<java.lang.String> untrackedFolders) |
private java.util.Set<java.lang.String> |
filterIgnorePaths(java.util.Set<java.lang.String> inputPaths,
java.util.Set<java.lang.String> ignoredNotInIndex,
boolean exact) |
CleanCommand |
setCleanDirectories(boolean dirs)
If dirs is set, in addition to files, also clean directories.
|
CleanCommand |
setDryRun(boolean dryRun)
If dryRun is set, the paths in question will not actually be deleted.
|
CleanCommand |
setForce(boolean force)
If force is set, directories that are git repositories will also be
deleted.
|
CleanCommand |
setIgnore(boolean ignore)
If ignore is set, don't report/clean files/directories that are ignored
by a .gitignore.
|
CleanCommand |
setPaths(java.util.Set<java.lang.String> paths)
If paths are set, only these paths are affected by the cleaning.
|
checkCallable, getRepository, setCallableprivate java.util.Set<java.lang.String> paths
private boolean dryRun
private boolean directories
private boolean ignore
private boolean force
protected CleanCommand(Repository repo)
repo - the Repositorypublic java.util.Set<java.lang.String> call()
throws NoWorkTreeException,
GitAPIException
Execute the command
Executes the clean command with all the options and parameters
collected by the setter methods of this class. Each instance of this
class should only be used for one invocation of the command (means: one
call to call())
call in interface java.util.concurrent.Callable<java.util.Set<java.lang.String>>call in class GitCommand<java.util.Set<java.lang.String>>NoWorkTreeExceptionGitAPIExceptionprivate java.util.Set<java.lang.String> cleanPath(java.lang.String path,
java.util.Set<java.lang.String> inFiles)
throws java.io.IOException
directories is true.
Paths that are git repositories are recursively deleted when
directories and force are both true.path - The path to be cleanedinFiles - A set of strings representing the files that have been cleaned
already, the path to be cleaned will be added to this set
before being returned.java.io.IOExceptionprivate java.util.Set<java.lang.String> filterIgnorePaths(java.util.Set<java.lang.String> inputPaths,
java.util.Set<java.lang.String> ignoredNotInIndex,
boolean exact)
private java.util.Set<java.lang.String> filterFolders(java.util.Set<java.lang.String> untracked,
java.util.Set<java.lang.String> untrackedFolders)
public CleanCommand setPaths(java.util.Set<java.lang.String> paths)
paths - the paths to set (with / as separator)thispublic CleanCommand setDryRun(boolean dryRun)
dryRun - whether to do a dry run or notthispublic CleanCommand setForce(boolean force)
force - whether or not to delete git repositoriesthispublic CleanCommand setCleanDirectories(boolean dirs)
dirs - whether to clean directories too, or only files.thispublic CleanCommand setIgnore(boolean ignore)
ignore - whether to respect .gitignore or not.this