aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileSnapshot.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileSnapshot.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileSnapshot.java
index 87ae57b824..c844404e13 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileSnapshot.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/FileSnapshot.java
@@ -45,8 +45,6 @@ package org.eclipse.jgit.storage.file;
import java.io.File;
-import org.eclipse.jgit.util.SystemReader;
-
/**
* Caches when a file was last read, making it possible to detect future edits.
* <p>
@@ -84,7 +82,7 @@ public class FileSnapshot {
* @return the snapshot.
*/
public static FileSnapshot save(File path) {
- final long read = SystemReader.getInstance().getCurrentTime();
+ final long read = System.currentTimeMillis();
final long modified = path.lastModified();
return new FileSnapshot(read, modified);
}
@@ -109,8 +107,8 @@ public class FileSnapshot {
}
/**
- * Check if the path has been modified since the snapshot was saved.
- *
+ * Check if the path may have been modified since the snapshot was saved.
+ *
* @param path
* the path the snapshot describes.
* @return true if the path needs to be read again.
@@ -203,6 +201,12 @@ public class FileSnapshot {
return false;
}
+ // Our lastRead flag may be old, refresh and retry
+ lastRead = System.currentTimeMillis();
+ if (notRacyClean(lastRead)) {
+ return false;
+ }
+
// We last read this path too close to its last observed
// modification time. We may have missed a modification.
// Scan again, to ensure we still see the same state.