public class GarbageCollectCommand extends GitCommand<Properties>
gc
command. It has setters for all
supported options and arguments of this command and a call()
method
to finally execute the command. Each instance of this class should only be
used for one invocation of the command (means: one call to call()
)Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_GC_AGGRESSIVE_DEPTH
Default value of maximum delta chain depth during aggressive garbage
collection: 250
|
static int |
DEFAULT_GC_AGGRESSIVE_WINDOW
Default window size during packing during aggressive garbage collection:
* 250
|
repo
Modifier | Constructor and Description |
---|---|
protected |
GarbageCollectCommand(Repository repo)
Constructor for GarbageCollectCommand.
|
Modifier and Type | Method and Description |
---|---|
Properties |
call() |
Properties |
getStatistics()
Computes and returns the repository statistics.
|
GarbageCollectCommand |
setAggressive(boolean aggressive)
Whether to use aggressive mode or not.
|
GarbageCollectCommand |
setExpire(Date expire)
During gc() or prune() each unreferenced, loose object which has been
created or modified after
expire will not be pruned. |
GarbageCollectCommand |
setPreserveOldPacks(boolean preserveOldPacks)
Whether to preserve old pack files instead of deleting them.
|
GarbageCollectCommand |
setProgressMonitor(ProgressMonitor monitor)
Set progress monitor
|
GarbageCollectCommand |
setPrunePreserved(boolean prunePreserved)
Whether to prune preserved pack files in the preserved directory.
|
checkCallable, getRepository, setCallable
public static final int DEFAULT_GC_AGGRESSIVE_DEPTH
public static final int DEFAULT_GC_AGGRESSIVE_WINDOW
protected GarbageCollectCommand(Repository repo)
repo
- a Repository
object.public GarbageCollectCommand setProgressMonitor(ProgressMonitor monitor)
monitor
- a progress monitorpublic GarbageCollectCommand setExpire(Date expire)
expire
will not be pruned. Only
older objects may be pruned. If set to null then every object is a
candidate for pruning. Use GitDateParser
to
parse time formats used by git gc.expire
- minimal age of objects to be pruned.public GarbageCollectCommand setAggressive(boolean aggressive)
true
compressed objects found in old packs are not reused
but every object is compressed again. Configuration variables
pack.window and pack.depth are set to 250 for this GC.aggressive
- whether to turn on or off aggressive modepublic GarbageCollectCommand setPreserveOldPacks(boolean preserveOldPacks)
preserveOldPacks
- whether to preserve old pack filespublic GarbageCollectCommand setPrunePreserved(boolean prunePreserved)
prunePreserved
- whether to prune preserved pack filespublic Properties call() throws GitAPIException
Execute the command
call
in interface Callable<Properties>
call
in class GitCommand<Properties>
GitAPIException
public Properties getStatistics() throws GitAPIException
GitAPIException
- thrown if the repository statistics cannot be computedCopyright © 2019 Eclipse JGit Project. All rights reserved.