summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src
diff options
context:
space:
mode:
authorJames Melvin <jmelvin@codeaurora.org>2017-01-03 11:41:56 -0700
committerChristian Halstrick <christian.halstrick@sap.com>2017-01-19 11:00:18 +0100
commit91132bb05e767694d35230d515443d54ddc4eff6 (patch)
treedfeffd43c1a25f91a05b376a8ca7b1ebf2acb528 /org.eclipse.jgit.pgm/src
parentd3148f300a06dec78875283bb8fdf1d350c4243d (diff)
downloadjgit-91132bb05e767694d35230d515443d54ddc4eff6.tar.gz
jgit-91132bb05e767694d35230d515443d54ddc4eff6.zip
gc: Add options to preserve and prune old pack files
The new --preserve-oldpacks option moves old pack files into the preserved subdirectory instead of deleting them after repacking. The new --prune-preserved option prunes old pack files from the preserved subdirectory after repacking, but before potentially moving the latest old packfiles to this subdirectory. These options are designed to prevent stale file handle exceptions during git operations which can happen on users of NFS repos when repacking is done on them. The strategy is to preserve old pack files around until the next repack with the hopes that they will become unreferenced by then and not cause any exceptions to running processes when they are finally deleted (pruned). Change-Id: If3f729f0d9ce920ee2c3e6acdde46f2068be61d2 Signed-off-by: James Melvin <jmelvin@codeaurora.org>
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Gc.java8
1 files changed, 8 insertions, 0 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 bf454760af..7289abb62f 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
@@ -52,10 +52,18 @@ class Gc extends TextBuiltin {
@Option(name = "--aggressive", usage = "usage_Aggressive")
private boolean aggressive;
+ @Option(name = "--preserve-oldpacks", usage = "usage_PreserveOldPacks")
+ private boolean preserveOldPacks;
+
+ @Option(name = "--prune-preserved", usage = "usage_PrunePreserved")
+ private boolean prunePreserved;
+
@Override
protected void run() throws Exception {
Git git = Git.wrap(db);
git.gc().setAggressive(aggressive)
+ .setPreserveOldPacks(preserveOldPacks)
+ .setPrunePreserved(prunePreserved)
.setProgressMonitor(new TextProgressMonitor(errw)).call();
}
}