aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-02-16 16:42:58 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2023-02-16 16:48:24 +0100
commitc46eb916110da7487248997c612b88930ceab328 (patch)
treecce236233aff65c4f14e4e29360c7317e437e4e4 /org.eclipse.jgit.pgm/src
parentda21265a141b68ea3069afd79107f7d374027bc0 (diff)
parent9424052f2797fabd8e1cee7f404eddadc7e3f72b (diff)
downloadjgit-c46eb916110da7487248997c612b88930ceab328.tar.gz
jgit-c46eb916110da7487248997c612b88930ceab328.zip
Merge branch 'stable-5.13' into stable-6.0
* stable-5.13: 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: I423f410578f5bbe178832b80fef8998a5372182c
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-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);
}