aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Baumgart2011-02-09 09:02:22 (EST)
committerJens Baumgart2011-02-09 09:02:22 (EST)
commitc9e4a78555e828e5eecaa6fb0d89b7b460cab48b (patch)
treefe04d3a33491738b527588b6a5947757fc4271bc
parent724af77c65c27eb24d41989bed3229910dbe063c (diff)
downloadjgit-c9e4a78555e828e5eecaa6fb0d89b7b460cab48b.zip
jgit-c9e4a78555e828e5eecaa6fb0d89b7b460cab48b.tar.gz
jgit-c9e4a78555e828e5eecaa6fb0d89b7b460cab48b.tar.bz2
Add isOutdated method to DirCacherefs/changes/67/2467/1
isOutdated returns true iff the memory state differs from the index file. Change-Id: If35db06743f5f588ab19d360fd2a18a07c918edb Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
index 143447c..c2c57c9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
@@ -312,6 +312,16 @@ public class DirCache {
}
}
+ /**
+ * @return true if the memory state differs from the index file
+ * @throws IOException
+ */
+ public boolean isOutdated() throws IOException {
+ if (liveFile == null || !liveFile.exists())
+ return false;
+ return liveFile.lastModified() != lastModified;
+ }
+
/** Empty this index, removing all entries. */
public void clear() {
lastModified = 0;