Package org.eclipse.jgit.api
Class CleanCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<java.util.Set<java.lang.String>>
-
- org.eclipse.jgit.api.CleanCommand
-
- All Implemented Interfaces:
java.util.concurrent.Callable<java.util.Set<java.lang.String>>
public class CleanCommand extends GitCommand<java.util.Set<java.lang.String>>
Remove untracked files from the working tree- See Also:
- Git documentation about Clean
-
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CleanCommand(Repository repo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<java.lang.String>
call()
Executes theclean
command with all the options and parameters collected by the setter methods of this class.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
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.-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Constructor Detail
-
CleanCommand
protected CleanCommand(Repository repo)
- Parameters:
repo
-
-
-
Method Detail
-
call
public java.util.Set<java.lang.String> call() throws NoWorkTreeException, GitAPIException
Executes theclean
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 tocall()
)- Specified by:
call
in interfacejava.util.concurrent.Callable<java.util.Set<java.lang.String>>
- Specified by:
call
in classGitCommand<java.util.Set<java.lang.String>>
- Returns:
- a set of strings representing each file cleaned.
- Throws:
GitAPIException
NoWorkTreeException
-
setPaths
public CleanCommand setPaths(java.util.Set<java.lang.String> paths)
If paths are set, only these paths are affected by the cleaning.- Parameters:
paths
- the paths to set (with/
as separator)- Returns:
this
-
setDryRun
public CleanCommand setDryRun(boolean dryRun)
If dryRun is set, the paths in question will not actually be deleted.- Parameters:
dryRun
- whether to do a dry run or not- Returns:
this
-
setCleanDirectories
public CleanCommand setCleanDirectories(boolean dirs)
If dirs is set, in addition to files, also clean directories.- Parameters:
dirs
- whether to clean directories too, or only files.- Returns:
this
-
setIgnore
public CleanCommand setIgnore(boolean ignore)
If ignore is set, don't report/clean files/directories that are ignored by a .gitignore. otherwise do handle them.- Parameters:
ignore
- whether to respect .gitignore or not.- Returns:
this
-
-