aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-06-21 18:12:14 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-07-17 09:42:14 +0200
commit16760c3e9a242f21538c2f4da1aad96953cafc37 (patch)
tree15146bff31bd9b3f27662baf04bdc5726944e4f2 /org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
parent0966731cad37fab239d458735c14be012cc70958 (diff)
downloadjgit-16760c3e9a242f21538c2f4da1aad96953cafc37.tar.gz
jgit-16760c3e9a242f21538c2f4da1aad96953cafc37.zip
Persist filesystem timestamp resolution and allow manual configuration
To enable persisting filesystem timestamp resolution per FileStore add a new config section to the user global git configuration: - Config section is "filesystem" - Config subsection is concatenation of - Java vendor (system property "java.vm.vendor") - runtime version (system property "java.vm.version") - FileStore's name - separated by '|' e.g. "AdoptOpenJDK|1.8.0_212-b03|/dev/disk1s1" The prefix is needed since some Java versions do not expose the full timestamp resolution of the underlying filesystem. This may also depend on the underlying operating system hence concrete key values may not be portable. - Config key for timestamp resolution is "timestampResolution" as a time value, supported time units are those supported by DefaultTypedConfigGetter#getTimeUnit If timestamp resolution is already configured for a given FileStore the configured value is used instead of measuring the resolution. When timestamp resolution was measured it is persisted in the user global git configuration. Example: [filesystem "AdoptOpenJDK|1.8.0_212-b03|/dev/disk1s1"] timestampResolution = 1 seconds If locking the git config file fails retry saving the resolution up to 5 times in order to workaround races with another thread. In order to avoid stack overflow use the fallback filesystem timestamp resolution when loading FileBasedConfig which creates itself a FileSnapshot to help checking if the config changed. Note: - on some OSes Java 8,9 truncate to milliseconds or seconds, see https://bugs.openjdk.java.net/browse/JDK-8177809, fixed in Java 10 - UnixFileAttributes up to Java 12 truncates timestamp resolution to microseconds when converting the internal representation to FileTime exposed in the API, see https://bugs.openjdk.java.net/browse/JDK-8181493 - WindowsFileAttributes also provides only microsecond resolution up to Java 12 Hence do not attempt to manually configure a higher timestamp resolution than supported by the Java version being used at runtime. Bug: 546891 Bug: 548188 Change-Id: Iff91b8f9e6e5e2295e1463f87c8e95edf4abbcf8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java12
1 files changed, 12 insertions, 0 deletions
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 d4a0280da6..4f636d4553 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
@@ -432,4 +432,16 @@ public final class ConfigConstants {
* @since 4.11
*/
public static final String CONFIG_SECTION_LFS = "lfs";
+
+ /**
+ * The "filesystem" section
+ * @since 5.1.9
+ */
+ public static final String CONFIG_FILESYSTEM_SECTION = "filesystem";
+
+ /**
+ * The "timestampResolution" key
+ * @since 5.1.9
+ */
+ public static final String CONFIG_KEY_TIMESTAMP_RESOLUTION = "timestampResolution";
}