Package org.eclipse.jgit.api
Class GarbageCollectCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<java.util.Properties>
-
- org.eclipse.jgit.api.GarbageCollectCommand
-
- All Implemented Interfaces:
java.util.concurrent.Callable<java.util.Properties>
public class GarbageCollectCommand extends GitCommand<java.util.Properties>
A class used to execute agccommand. It has setters for all supported options and arguments of this command and acall()method to finally execute the command. Each instance of this class should only be used for one invocation of the command (means: one call tocall())- Since:
- 2.2
- See Also:
- Git documentation about gc
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_GC_AGGRESSIVE_DEPTHDefault value of maximum delta chain depth during aggressive garbage collection: 250static intDEFAULT_GC_AGGRESSIVE_WINDOWDefault window size during packing during aggressive garbage collection: * 250private java.util.Dateexpireprivate ProgressMonitormonitorprivate PackConfigpconfig-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedGarbageCollectCommand(Repository repo)Constructor for GarbageCollectCommand.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Propertiescall()java.util.PropertiesgetStatistics()Computes and returns the repository statistics.GarbageCollectCommandsetAggressive(boolean aggressive)Whether to use aggressive mode or not.GarbageCollectCommandsetExpire(java.util.Date expire)During gc() or prune() each unreferenced, loose object which has been created or modified afterexpirewill not be pruned.GarbageCollectCommandsetPreserveOldPacks(boolean preserveOldPacks)Whether to preserve old pack files instead of deleting them.GarbageCollectCommandsetProgressMonitor(ProgressMonitor monitor)Set progress monitorGarbageCollectCommandsetPrunePreserved(boolean prunePreserved)Whether to prune preserved pack files in the preserved directory.private static java.util.PropertiestoProperties(GC.RepoStatistics stats)-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Field Detail
-
DEFAULT_GC_AGGRESSIVE_DEPTH
public static final int DEFAULT_GC_AGGRESSIVE_DEPTH
Default value of maximum delta chain depth during aggressive garbage collection: 250- Since:
- 3.6
- See Also:
- Constant Field Values
-
DEFAULT_GC_AGGRESSIVE_WINDOW
public static final int DEFAULT_GC_AGGRESSIVE_WINDOW
Default window size during packing during aggressive garbage collection: * 250- Since:
- 3.6
- See Also:
- Constant Field Values
-
monitor
private ProgressMonitor monitor
-
expire
private java.util.Date expire
-
pconfig
private PackConfig pconfig
-
-
Constructor Detail
-
GarbageCollectCommand
protected GarbageCollectCommand(Repository repo)
Constructor for GarbageCollectCommand.- Parameters:
repo- aRepositoryobject.
-
-
Method Detail
-
setProgressMonitor
public GarbageCollectCommand setProgressMonitor(ProgressMonitor monitor)
Set progress monitor- Parameters:
monitor- a progress monitor- Returns:
- this instance
-
setExpire
public GarbageCollectCommand setExpire(java.util.Date expire)
During gc() or prune() each unreferenced, loose object which has been created or modified afterexpirewill not be pruned. Only older objects may be pruned. If set to null then every object is a candidate for pruning. UseGitDateParserto parse time formats used by git gc.- Parameters:
expire- minimal age of objects to be pruned.- Returns:
- this instance
-
setAggressive
public GarbageCollectCommand setAggressive(boolean aggressive)
Whether to use aggressive mode or not. If set to true JGit behaves more similar to native git's "git gc --aggressive". If set totruecompressed 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
-
setPreserveOldPacks
public GarbageCollectCommand setPreserveOldPacks(boolean preserveOldPacks)
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
public GarbageCollectCommand setPrunePreserved(boolean prunePreserved)
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
public java.util.Properties call() throws GitAPIExceptionExecute the command
- Specified by:
callin interfacejava.util.concurrent.Callable<java.util.Properties>- Specified by:
callin classGitCommand<java.util.Properties>- Throws:
GitAPIException
-
getStatistics
public java.util.Properties getStatistics() throws GitAPIExceptionComputes and returns the repository statistics.- Returns:
- the repository statistics
- Throws:
GitAPIException- thrown if the repository statistics cannot be computed- Since:
- 3.0
-
toProperties
private static java.util.Properties toProperties(GC.RepoStatistics stats)
-
-