]> source.dussan.org Git - jgit.git/commitdiff
Fixed FileTreeIteratorWithTimeControl 03/1203/2
authorStefan Lay <stefan.lay@sap.com>
Fri, 30 Jul 2010 15:35:29 +0000 (17:35 +0200)
committerStefan Lay <stefan.lay@sap.com>
Fri, 30 Jul 2010 15:35:29 +0000 (17:35 +0200)
getEntryLastModified returned wrong values for
timestamps on boundaries.

Change-Id: I0457ff030946fda7ecc70671bc65db02a8c206ee
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorWithTimeControl.java

index fc19321c0ae7844f4afad85f43cf194104fdaf60..bb76d0075d32c5272f817459598f745ae7e4068c 100644 (file)
@@ -65,7 +65,7 @@ import org.eclipse.jgit.util.FS;
  * This class was written especially to test racy-git problems
  */
 public class FileTreeIteratorWithTimeControl extends FileTreeIterator {
-       private TreeSet<Long> modTimes = new TreeSet<Long>();
+       private TreeSet<Long> modTimes;
 
        public FileTreeIteratorWithTimeControl(FileTreeIterator p, Repository repo,
                        TreeSet<Long> modTimes) {
@@ -99,7 +99,9 @@ public class FileTreeIteratorWithTimeControl extends FileTreeIterator {
 
        @Override
        public long getEntryLastModified() {
-               Long cutOff = Long.valueOf(super.getEntryLastModified());
+               if (modTimes == null)
+                       return 0;
+               Long cutOff = Long.valueOf(super.getEntryLastModified() + 1);
                SortedSet<Long> head = modTimes.headSet(cutOff);
                return head.isEmpty() ? 0 : head.last().longValue();
        }