summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-01-05 15:56:42 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2023-01-05 16:05:14 +0100
commite4c2331af6aedf8ff4b80e627b76925bf10fa147 (patch)
tree64d94de2940272fabb8dd779dbb6c7d782b82427 /org.eclipse.jgit
parent246981c850d285895ebd76c05b7f9924e1a6144c (diff)
parent62ed46da16fb885180190f671ec2b6693bc440c3 (diff)
downloadjgit-e4c2331af6aedf8ff4b80e627b76925bf10fa147.tar.gz
jgit-e4c2331af6aedf8ff4b80e627b76925bf10fa147.zip
Merge branch 'stable-6.2' into stable-6.3
* stable-6.2: Introduce core.trustPackedRefsStat config Fix documentation for core.trustFolderStat Change-Id: I48b6c095ac62dc859829d6fef45325accbb0a144
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/.settings/.api_filters175
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java34
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java21
4 files changed, 234 insertions, 2 deletions
diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters
index e69de29bb2..f0c98e4b70 100644
--- a/org.eclipse.jgit/.settings/.api_filters
+++ b/org.eclipse.jgit/.settings/.api_filters
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.jgit" version="2">
+ <resource path="src/org/eclipse/jgit/lib/ConfigConstants.java" type="org.eclipse.jgit.lib.ConfigConstants">
+ <filter id="1142947843">
+ <message_arguments>
+ <message_argument value="5.13.2"/>
+ <message_argument value="SHA1_IMPLEMENTATION"/>
+ </message_arguments>
+ </filter>
+ <filter id="1142947843">
+ <message_arguments>
+ <message_argument value="6.1.1"/>
+ <message_argument value="CONFIG_KEY_TRUST_PACKED_REFS_STAT"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/jgit/lib/CoreConfig.java" type="org.eclipse.jgit.lib.CoreConfig$TrustPackedRefsStat">
+ <filter id="1142947843">
+ <message_arguments>
+ <message_argument value="6.1.1"/>
+ <message_argument value="TrustPackedRefsStat"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/jgit/merge/ResolveMerger.java" type="org.eclipse.jgit.merge.ResolveMerger">
+ <filter id="336658481">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.merge.ResolveMerger"/>
+ <message_argument value="workTreeUpdater"/>
+ </message_arguments>
+ </filter>
+ <filter id="338755678">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.merge.ResolveMerger"/>
+ <message_argument value="builder"/>
+ </message_arguments>
+ </filter>
+ <filter id="338755678">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.merge.ResolveMerger"/>
+ <message_argument value="implicitDirCache"/>
+ </message_arguments>
+ </filter>
+ <filter id="338755678">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.merge.ResolveMerger"/>
+ <message_argument value="toBeCheckedOut"/>
+ </message_arguments>
+ </filter>
+ <filter id="338755678">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.merge.ResolveMerger"/>
+ <message_argument value="toBeDeleted"/>
+ </message_arguments>
+ </filter>
+ <filter id="338755678">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.merge.ResolveMerger"/>
+ <message_argument value="workingTreeOptions"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.merge.ResolveMerger"/>
+ <message_argument value="addCheckoutMetadata(Map&lt;String,DirCacheCheckout.CheckoutMetadata&gt;, String, Attributes)"/>
+ </message_arguments>
+ </filter>
+ <filter id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.merge.ResolveMerger"/>
+ <message_argument value="cleanUp()"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/jgit/merge/ResolveMerger.java" type="org.eclipse.jgit.merge.ResolveMerger$WorkTreeUpdater">
+ <filter id="1142947843">
+ <message_arguments>
+ <message_argument value="6.3.1"/>
+ <message_argument value="WorkTreeUpdater"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/jgit/transport/AwsRequestSignerV4.java" type="org.eclipse.jgit.transport.AwsRequestSignerV4">
+ <filter id="1109393411">
+ <message_arguments>
+ <message_argument value="5.13.1"/>
+ <message_argument value="org.eclipse.jgit.transport.AwsRequestSignerV4"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/jgit/util/HttpSupport.java" type="org.eclipse.jgit.util.HttpSupport">
+ <filter id="1142947843">
+ <message_arguments>
+ <message_argument value="5.13.1"/>
+ <message_argument value="urlEncode(String, boolean)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/jgit/util/Paths.java" type="org.eclipse.jgit.util.Paths">
+ <filter id="337768515">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.util.Paths"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/jgit/util/sha1/SHA1.java" type="org.eclipse.jgit.util.sha1.SHA1">
+ <filter id="337764418">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.util.sha1.SHA1"/>
+ </message_arguments>
+ </filter>
+ <filter id="421650549">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.util.sha1.SHA1"/>
+ <message_argument value="digest()"/>
+ </message_arguments>
+ </filter>
+ <filter id="421650549">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.util.sha1.SHA1"/>
+ <message_argument value="digest(MutableObjectId)"/>
+ </message_arguments>
+ </filter>
+ <filter id="421650549">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.util.sha1.SHA1"/>
+ <message_argument value="hasCollision()"/>
+ </message_arguments>
+ </filter>
+ <filter id="421650549">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.util.sha1.SHA1"/>
+ <message_argument value="reset()"/>
+ </message_arguments>
+ </filter>
+ <filter id="421650549">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.util.sha1.SHA1"/>
+ <message_argument value="setDetectCollision(boolean)"/>
+ </message_arguments>
+ </filter>
+ <filter id="421650549">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.util.sha1.SHA1"/>
+ <message_argument value="toObjectId()"/>
+ </message_arguments>
+ </filter>
+ <filter id="421650549">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.util.sha1.SHA1"/>
+ <message_argument value="update(byte)"/>
+ </message_arguments>
+ </filter>
+ <filter id="421650549">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.util.sha1.SHA1"/>
+ <message_argument value="update(byte[])"/>
+ </message_arguments>
+ </filter>
+ <filter id="421650549">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.util.sha1.SHA1"/>
+ <message_argument value="update(byte[], int, int)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/jgit/util/sha1/SHA1.java" type="org.eclipse.jgit.util.sha1.SHA1$Sha1Implementation">
+ <filter id="1142947843">
+ <message_arguments>
+ <message_argument value="5.13.2"/>
+ <message_argument value="Sha1Implementation"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
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 7d3792ef46..94a377fd3f 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
@@ -28,7 +28,9 @@ import static org.eclipse.jgit.lib.Ref.Storage.PACKED;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.InterruptedIOException;
import java.nio.file.DirectoryNotEmptyException;
@@ -59,6 +61,7 @@ import org.eclipse.jgit.events.RefsChangedEvent;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.CoreConfig.TrustPackedRefsStat;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectIdRef;
import org.eclipse.jgit.lib.Ref;
@@ -891,10 +894,37 @@ public class RefDirectory extends RefDatabase {
boolean trustFolderStat = getRepository().getConfig().getBoolean(
ConfigConstants.CONFIG_CORE_SECTION,
ConfigConstants.CONFIG_KEY_TRUSTFOLDERSTAT, true);
+ TrustPackedRefsStat trustPackedRefsStat =
+ getRepository().getConfig().getEnum(
+ ConfigConstants.CONFIG_CORE_SECTION,
+ null,
+ ConfigConstants.CONFIG_KEY_TRUST_PACKED_REFS_STAT,
+ TrustPackedRefsStat.UNSET);
final PackedRefList curList = packedRefs.get();
- if (trustFolderStat && !curList.snapshot.isModified(packedRefsFile)) {
- return curList;
+
+ switch (trustPackedRefsStat) {
+ case NEVER:
+ break;
+ case AFTER_OPEN:
+ try (InputStream stream = Files
+ .newInputStream(packedRefsFile.toPath())) {
+ // open the file to refresh attributes (on some NFS clients)
+ } catch (FileNotFoundException e) {
+ // Ignore as packed-refs may not exist
+ }
+ //$FALL-THROUGH$
+ case ALWAYS:
+ if (!curList.snapshot.isModified(packedRefsFile)) {
+ return curList;
+ }
+ break;
+ case UNSET:
+ if (trustFolderStat
+ && !curList.snapshot.isModified(packedRefsFile)) {
+ return curList;
+ }
+ break;
}
final PackedRefList newList = readPackedRefs();
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 47a572b83a..4b1a72e224 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
@@ -886,4 +886,10 @@ public final class ConfigConstants {
*/
public static final String CONFIG_KEY_ABBREV = "abbrev";
+ /**
+ * The "trustPackedRefsStat" key
+ *
+ * @since 6.1.1
+ */
+ public static final String CONFIG_KEY_TRUST_PACKED_REFS_STAT = "trustPackedRefsStat";
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
index f23c6e08d1..fc82a5fead 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
@@ -116,6 +116,27 @@ public class CoreConfig {
ALWAYS
}
+ /**
+ * Permissible values for {@code core.trustPackedRefsStat}.
+ *
+ * @since 6.1.1
+ */
+ public enum TrustPackedRefsStat {
+ /** Do not trust file attributes of the packed-refs file. */
+ NEVER,
+
+ /** Trust file attributes of the packed-refs file. */
+ ALWAYS,
+
+ /** Open and close the packed-refs file to refresh its file attributes
+ * and then trust it. */
+ AFTER_OPEN,
+
+ /** {@code core.trustPackedRefsStat} defaults to this when it is
+ * not set */
+ UNSET
+ }
+
private final int compression;
private final int packIndexVersion;