public class GarbageCollectCommand extends GitCommand<java.util.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
|
private java.util.Date |
expire |
private ProgressMonitor |
monitor |
private PackConfig |
pconfig |
repo
Modifier | Constructor and Description |
---|---|
protected |
GarbageCollectCommand(Repository repo)
Constructor for GarbageCollectCommand.
|
Modifier and Type | Method and Description |
---|---|
java.util.Properties |
call() |
java.util.Properties |
getStatistics()
Computes and returns the repository statistics.
|
GarbageCollectCommand |
setAggressive(boolean aggressive)
Whether to use aggressive mode or not.
|
GarbageCollectCommand |
setExpire(java.util.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.
|
private static java.util.Properties |
toProperties(GC.RepoStatistics stats) |
checkCallable, getRepository, setCallable
public static final int DEFAULT_GC_AGGRESSIVE_DEPTH
public static final int DEFAULT_GC_AGGRESSIVE_WINDOW
private ProgressMonitor monitor
private java.util.Date expire
private PackConfig pconfig
protected GarbageCollectCommand(Repository repo)
repo
- a Repository
object.public GarbageCollectCommand setProgressMonitor(ProgressMonitor monitor)
monitor
- a progress monitorpublic GarbageCollectCommand setExpire(java.util.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 java.util.Properties call() throws GitAPIException
Execute the command
call
in interface java.util.concurrent.Callable<java.util.Properties>
call
in class GitCommand<java.util.Properties>
GitAPIException
public java.util.Properties getStatistics() throws GitAPIException
GitAPIException
- thrown if the repository statistics cannot be computedprivate static java.util.Properties toProperties(GC.RepoStatistics stats)