aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/internal
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2021-12-31 00:29:40 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2021-12-31 00:29:40 +0100
commitc8ab1392d16ffa274501ab7420fe05bb743eca34 (patch)
tree27e6b57b093f5f4e6b81fb77bfee315f7302cbf0 /org.eclipse.jgit/src/org/eclipse/jgit/internal
parent41406e278fb69df1dbf4dcb9a82dcb03f2a8d5d7 (diff)
parent44bad3d98e9fe41fc103b6981ec3c623ef9388f3 (diff)
downloadjgit-c8ab1392d16ffa274501ab7420fe05bb743eca34.tar.gz
jgit-c8ab1392d16ffa274501ab7420fe05bb743eca34.zip
Merge branch 'stable-5.12' into stable-5.13
* stable-5.12: Use FileSnapshot without using configs for FileBasedConfig Change-Id: I6a0266cbcaaf18d0d60f0abecb5434fd919c44b7
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/internal')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
index 78262e9773..d06b5a72d1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java
@@ -106,6 +106,8 @@ public class LockFile {
private boolean written;
+ private boolean snapshotNoConfig;
+
private FileSnapshot commitSnapshot;
private LockToken token;
@@ -403,6 +405,21 @@ public class LockFile {
}
/**
+ * Request that {@link #commit()} remember the
+ * {@link org.eclipse.jgit.internal.storage.file.FileSnapshot} without using
+ * config file to get filesystem timestamp resolution.
+ * This method should be invoked before the file is accessed.
+ * It is used by FileBasedConfig to avoid endless recursion.
+ *
+ * @param on
+ * true if the commit method must remember the FileSnapshot.
+ */
+ public void setNeedSnapshotNoConfig(boolean on) {
+ needSnapshot = on;
+ snapshotNoConfig = on;
+ }
+
+ /**
* Request that {@link #commit()} force dirty data to the drive.
*
* @param on
@@ -480,8 +497,12 @@ public class LockFile {
}
private void saveStatInformation() {
- if (needSnapshot)
- commitSnapshot = FileSnapshot.save(lck);
+ if (needSnapshot) {
+ commitSnapshot = snapshotNoConfig ?
+ // don't use config in this snapshot to avoid endless recursion
+ FileSnapshot.saveNoConfig(lck)
+ : FileSnapshot.save(lck);
+ }
}
/**