aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2010-12-30 15:31:06 -0500
committerCode Review <codereview-daemon@eclipse.org>2010-12-30 15:31:06 -0500
commit7a1bd7adb10325d57c887d45ab8622c99591f733 (patch)
treefced7b7e26336bd2360bcec1b2d6f6acbc3312aa /org.eclipse.jgit
parent488307ada70f79f1633121bbab25af6161285e3b (diff)
parentc3f52c62a8b8b1fbed77954c8fa2353a35d05236 (diff)
downloadjgit-7a1bd7adb10325d57c887d45ab8622c99591f733.tar.gz
jgit-7a1bd7adb10325d57c887d45ab8622c99591f733.zip
Merge "Fix FileSnapShot"
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.