- All Implemented Interfaces:
Callable<Properties>
A class used to execute a
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()
)- Since:
- 2.2
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Default value of maximum delta chain depth during aggressive garbage collection: 250static final int
Default window size during packing during aggressive garbage collection: * 250Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructor for GarbageCollectCommand. -
Method Summary
Modifier and TypeMethodDescriptioncall()
Computes and returns the repository statistics.setAggressive
(boolean aggressive) Whether to use aggressive mode or not.During gc() or prune() each unreferenced, loose object which has been created or modified afterexpire
will not be pruned.setPackKeptObjects
(boolean packKeptObjects) Whether to include objects in `.keep` packs when repacking.setPreserveOldPacks
(boolean preserveOldPacks) Whether to preserve old pack files instead of deleting them.setProgressMonitor
(ProgressMonitor monitor) Set progress monitorsetPrunePreserved
(boolean prunePreserved) Whether to prune preserved pack files in the preserved directory.Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
Field Details
-
DEFAULT_GC_AGGRESSIVE_DEPTH
public static final int DEFAULT_GC_AGGRESSIVE_DEPTHDefault value of maximum delta chain depth during aggressive garbage collection: 250- Since:
- 3.6
- See Also:
-
DEFAULT_GC_AGGRESSIVE_WINDOW
public static final int DEFAULT_GC_AGGRESSIVE_WINDOWDefault window size during packing during aggressive garbage collection: * 250- Since:
- 3.6
- See Also:
-
-
Constructor Details
-
GarbageCollectCommand
Constructor for GarbageCollectCommand.- Parameters:
repo
- aRepository
object.
-
-
Method Details
-
setProgressMonitor
Set progress monitor- Parameters:
monitor
- a progress monitor- Returns:
- this instance
-
setExpire
During gc() or prune() each unreferenced, loose object which has been created or modified afterexpire
will not be pruned. Only older objects may be pruned. If set to null then every object is a candidate for pruning. UseGitDateParser
to parse time formats used by git gc.- Parameters:
expire
- minimal age of objects to be pruned.- Returns:
- this instance
-
setAggressive
Whether to use aggressive mode or not. If set to true JGit behaves more similar to native git's "git gc --aggressive". If set totrue
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.- Parameters:
aggressive
- whether to turn on or off aggressive mode- Returns:
- this instance
- Since:
- 3.6
-
setPackKeptObjects
Whether to include objects in `.keep` packs when repacking.- Parameters:
packKeptObjects
- whether to include objects in `.keep` files when repacking.- Returns:
- this instance
- Since:
- 5.13.3
-
setPreserveOldPacks
Whether to preserve old pack files instead of deleting them.- Parameters:
preserveOldPacks
- whether to preserve old pack files- Returns:
- this instance
- Since:
- 4.7
-
setPrunePreserved
Whether to prune preserved pack files in the preserved directory.- Parameters:
prunePreserved
- whether to prune preserved pack files- Returns:
- this instance
- Since:
- 4.7
-
call
Description copied from class:GitCommand
Execute the command
- Specified by:
call
in interfaceCallable<Properties>
- Specified by:
call
in classGitCommand<Properties>
- Throws:
GitAPIException
-
getStatistics
Computes and returns the repository statistics.- Returns:
- the repository statistics
- Throws:
GitAPIException
- thrown if the repository statistics cannot be computed- Since:
- 3.0
-