]> source.dussan.org Git - jgit.git/commitdiff
Add isOutdated method to DirCache 67/2467/1
authorJens Baumgart <jens.baumgart@sap.com>
Wed, 9 Feb 2011 14:02:22 +0000 (15:02 +0100)
committerJens Baumgart <jens.baumgart@sap.com>
Wed, 9 Feb 2011 14:02:22 +0000 (15:02 +0100)
isOutdated returns true iff the memory state differs from the index
file.

Change-Id: If35db06743f5f588ab19d360fd2a18a07c918edb
Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java

index 143447c8d6b1871e4dcd976b925239817ba35f83..c2c57c9840157635ee6ef1b2b210b7afeb323b96 100644 (file)
@@ -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;