summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-02-16 16:56:07 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2023-02-16 16:59:09 +0100
commit07a9eb06ff9d223af92063a643095ecba2c3d28a (patch)
tree6429f107b11882c809d7561a8820617ef8dc25e5 /org.eclipse.jgit.pgm
parent012cb779304ccc6c089be06a2f5c12c293f11453 (diff)
parentc46eb916110da7487248997c612b88930ceab328 (diff)
downloadjgit-07a9eb06ff9d223af92063a643095ecba2c3d28a.tar.gz
jgit-07a9eb06ff9d223af92063a643095ecba2c3d28a.zip
Merge branch 'stable-6.0' into stable-6.1
* stable-6.0: Add pack options to preserve and prune old pack files Allow to perform PackedBatchRefUpdate without locking loose refs Document option "core.sha1Implementation" introduced in 59029aec Change-Id: I876a38c2de8b7d5eaacd00e36b85599f88173221
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java18
1 files changed, 12 insertions, 6 deletions
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 177be7066d..c87f0b6dcf 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
@@ -10,6 +10,7 @@
package org.eclipse.jgit.pgm;
+import org.eclipse.jgit.api.GarbageCollectCommand;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.TextProgressMonitor;
@@ -21,20 +22,25 @@ class Gc extends TextBuiltin {
private boolean aggressive;
@Option(name = "--preserve-oldpacks", usage = "usage_PreserveOldPacks")
- private boolean preserveOldPacks;
+ private Boolean preserveOldPacks;
@Option(name = "--prune-preserved", usage = "usage_PrunePreserved")
- private boolean prunePreserved;
+ private Boolean prunePreserved;
/** {@inheritDoc} */
@Override
protected void run() {
Git git = Git.wrap(db);
try {
- git.gc().setAggressive(aggressive)
- .setPreserveOldPacks(preserveOldPacks)
- .setPrunePreserved(prunePreserved)
- .setProgressMonitor(new TextProgressMonitor(errw)).call();
+ GarbageCollectCommand command = git.gc().setAggressive(aggressive)
+ .setProgressMonitor(new TextProgressMonitor(errw));
+ if (preserveOldPacks != null) {
+ command.setPreserveOldPacks(preserveOldPacks.booleanValue());
+ }
+ if (prunePreserved != null) {
+ command.setPrunePreserved(prunePreserved.booleanValue());
+ }
+ command.call();
} catch (GitAPIException e) {
throw die(e.getMessage(), e);
}