aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-02-16 16:59:56 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2023-02-16 16:59:56 +0100
commitd8155c137ea83b62ca850473ffbb68544656bc1d (patch)
tree583afe8604cf973a1ec5c9497acc37cfc2bc6682 /org.eclipse.jgit
parentd8c02aec6a46a14907b498384ac6968a65bcd14d (diff)
parent07a9eb06ff9d223af92063a643095ecba2c3d28a (diff)
downloadjgit-d8155c137ea83b62ca850473ffbb68544656bc1d.tar.gz
jgit-d8155c137ea83b62ca850473ffbb68544656bc1d.zip
Merge branch 'stable-6.1' into stable-6.2
* stable-6.1: Fix getPackedRefs to not throw NoSuchFileException 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: Id32683d5f506e082d39af269803bccee0280cc27
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/.settings/.api_filters12
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java14
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java6
4 files changed, 34 insertions, 1 deletions
diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters
index 3e62b565ff..574467e4f7 100644
--- a/org.eclipse.jgit/.settings/.api_filters
+++ b/org.eclipse.jgit/.settings/.api_filters
@@ -10,6 +10,18 @@
<filter id="1142947843">
<message_arguments>
<message_argument value="5.13.2"/>
+ <message_argument value="CONFIG_KEY_PRESERVE_OLD_PACKS"/>
+ </message_arguments>
+ </filter>
+ <filter id="1142947843">
+ <message_arguments>
+ <message_argument value="5.13.2"/>
+ <message_argument value="CONFIG_KEY_PRUNE_PRESERVED"/>
+ </message_arguments>
+ </filter>
+ <filter id="1142947843">
+ <message_arguments>
+ <message_argument value="5.13.2"/>
<message_argument value="SHA1_IMPLEMENTATION"/>
</message_arguments>
</filter>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
index 348a22ca64..aa910d845c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
@@ -35,6 +35,7 @@ import java.io.InputStreamReader;
import java.io.InterruptedIOException;
import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.security.DigestInputStream;
import java.security.MessageDigest;
@@ -911,7 +912,7 @@ public class RefDirectory extends RefDatabase {
try (InputStream stream = Files
.newInputStream(packedRefsFile.toPath())) {
// open the file to refresh attributes (on some NFS clients)
- } catch (FileNotFoundException e) {
+ } catch (FileNotFoundException | NoSuchFileException e) {
// Ignore as packed-refs may not exist
}
//$FALL-THROUGH$
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
index 011c9fa546..96f3198cef 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
@@ -898,4 +898,18 @@ public final class ConfigConstants {
* @since 6.1.1
*/
public static final String CONFIG_KEY_TRUST_PACKED_REFS_STAT = "trustPackedRefsStat";
+
+ /**
+ * The "pack.preserveOldPacks" key
+ *
+ * @since 5.13.2
+ */
+ public static final String CONFIG_KEY_PRESERVE_OLD_PACKS = "preserveoldpacks";
+
+ /**
+ * The "pack.prunePreserved" key
+ *
+ * @since 5.13.2
+ */
+ public static final String CONFIG_KEY_PRUNE_PRESERVED = "prunepreserved";
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java
index a10f6cf88a..163e475887 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java
@@ -37,6 +37,8 @@ import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_WAIT_PREVENT_RACYP
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_WINDOW;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_WINDOW_MEMORY;
import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_PACK_SECTION;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PRESERVE_OLD_PACKS;
+import static org.eclipse.jgit.lib.ConfigConstants.CONFIG_KEY_PRUNE_PRESERVED;
import java.time.Duration;
import java.util.concurrent.Executor;
@@ -1267,6 +1269,10 @@ public class PackConfig {
setMinSizePreventRacyPack(rc.getLong(CONFIG_PACK_SECTION,
CONFIG_KEY_MIN_SIZE_PREVENT_RACYPACK,
getMinSizePreventRacyPack()));
+ setPreserveOldPacks(rc.getBoolean(CONFIG_PACK_SECTION,
+ CONFIG_KEY_PRESERVE_OLD_PACKS, DEFAULT_PRESERVE_OLD_PACKS));
+ setPrunePreserved(rc.getBoolean(CONFIG_PACK_SECTION,
+ CONFIG_KEY_PRUNE_PRESERVED, DEFAULT_PRUNE_PRESERVED));
}
/** {@inheritDoc} */