summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/resources
diff options
context:
space:
mode:
authorThomas Wolf <thomas.wolf@paranor.ch>2020-08-14 14:54:38 +0200
committerThomas Wolf <thomas.wolf@paranor.ch>2020-08-23 11:39:24 +0200
commit2990ad66ade8289f1d91a00b65a2406fabd1dea2 (patch)
tree8dac21bb90a2525661dced4a33c8cb0b6850a0c6 /org.eclipse.jgit/resources
parente9c7ba6fdccf64b16fdadd74106175f95454ec4f (diff)
downloadjgit-2990ad66ade8289f1d91a00b65a2406fabd1dea2.tar.gz
jgit-2990ad66ade8289f1d91a00b65a2406fabd1dea2.zip
FS: use binary search to determine filesystem timestamp resolution
Previous code used a minimum granularity of 1 microsecond and would iterate 233 times on a system where the resolution is 1 second (for instance, Java 8 on Mac APFS). New code uses a binary search between the maximum we care about (2 seconds) and zero, with a minimum granularity of also 1 microsecond. This takes at most 19 iterations (guaranteed). For a file system with 1 second resolution, it takes 4 iterations (1s, 0.5s, 0.8s, 0.9s). With an up-front check at 1 microsecond and at 1 millisecond this performs equally well as the old code on file systems with a fine resolution. (For instance, Java 11 on Mac APFS.) Also handle obscure cases where the file timestamp implementation may yield bogus values (as observed on HP NonStop). If such an error case occurs, log a warning and abort the measurement at the last good value. Bug: 565707 Change-Id: I82a96729b50c284be7c23fbdf3d0df1bddf60e41 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit/resources')
-rw-r--r--org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties3
1 files changed, 3 insertions, 0 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
index 4eee09faff..beafff3811 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -408,6 +408,9 @@ lockError=lock error: {0}
lockFailedRetry=locking {0} failed after {1} retries
lockOnNotClosed=Lock on {0} not closed.
lockOnNotHeld=Lock on {0} not held.
+logInconsistentFiletimeDiff={}: inconsistent duration from file timestamps on {}, {}: {} > {}, but diff = {}. Aborting measurement at resolution {}.
+logLargerFiletimeDiff={}: inconsistent duration from file timestamps on {}, {}: diff = {} > {} (last good value). Aborting measurement.
+logSmallerFiletime={}: got smaller file timestamp on {}, {}: {} < {}. Aborting measurement at resolution {}.
logXDGConfigHomeInvalid=Environment variable XDG_CONFIG_HOME contains an invalid path {}
maxCountMustBeNonNegative=max count must be >= 0
mergeConflictOnNonNoteEntries=Merge conflict on non-note entries: base = {0}, ours = {1}, theirs = {2}