summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2014-09-17 15:57:25 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2014-09-19 09:17:41 -0400
commit227357f929562e8010d96fedbe52df561af82c1d (patch)
treeb167ad7e57dc7443bdfdac0782af4137c993433e /org.eclipse.jgit.pgm
parentf2ebc8d4c5af5bfaf519d19a72eba477d10d86aa (diff)
downloadjgit-227357f929562e8010d96fedbe52df561af82c1d.tar.gz
jgit-227357f929562e8010d96fedbe52df561af82c1d.zip
Add "aggressive" option to GC
JGit should offer the possibility to do a garbage collection in "aggressive" mode. In this mode garbage collection more aggressively optimize the repository at the expense of taking much more time. Technically a aggressive mode garbage collection differs from a non-aggressive one by: - not reusing packed objects found in old packs. Recompress every object - the configuration pack.window is set to 250 (the default is 10) - the configuration pack.depths is set to 250 (the default is 50) The associated classes in org.eclipse.jgit.api and the command line command in org.eclipse.jgit.pgm expose this new option. The configuration parameters gc.aggressiveDepth and gc.aggressiveWindow have been introduced to configure this feature. Bug: 444332 Change-Id: I024101f2810acf6be13ce144c9893d98f5c4ae76
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties1
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java13
2 files changed, 9 insertions, 5 deletions
diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
index 574981d385..bdf05e901a 100644
--- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
+++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
@@ -184,6 +184,7 @@ unmergedPaths=Unmerged paths:
unsupportedOperation=Unsupported operation: {0}
untrackedFiles=Untracked files:
updating=Updating {0}..{1}
+usage_Aggressive=This option will cause gc to more aggressively optimize the repository at the expense of taking much more time
usage_Blame=Show what revision and author last modified each line
usage_CommandLineClientForamazonsS3Service=Command line client for Amazon's S3 service
usage_CommitAll=commit all modified and deleted files
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java
index 58813bcb00..aa5c90590e 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java
@@ -43,16 +43,19 @@
package org.eclipse.jgit.pgm;
-import org.eclipse.jgit.internal.storage.file.FileRepository;
-import org.eclipse.jgit.internal.storage.file.GC;
+import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.TextProgressMonitor;
+import org.kohsuke.args4j.Option;
@Command(common = true, usage = "usage_Gc")
class Gc extends TextBuiltin {
+ @Option(name = "--aggressive", usage = "usage_Aggressive")
+ private boolean aggressive;
+
@Override
protected void run() throws Exception {
- GC gc = new GC((FileRepository) db);
- gc.setProgressMonitor(new TextProgressMonitor());
- gc.gc();
+ Git git = Git.wrap(db);
+ git.gc().setAggressive(aggressive)
+ .setProgressMonitor(new TextProgressMonitor()).call();
}
}