From d9ceaa2f1e958abafc48b871ba0bd228fc1c7c0c Mon Sep 17 00:00:00 2001 From: Stefan Lay Date: Fri, 30 Jul 2010 17:35:29 +0200 Subject: [PATCH] Fixed FileTreeIteratorWithTimeControl getEntryLastModified returned wrong values for timestamps on boundaries. Change-Id: I0457ff030946fda7ecc70671bc65db02a8c206ee Signed-off-by: Stefan Lay --- .../jgit/treewalk/FileTreeIteratorWithTimeControl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorWithTimeControl.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorWithTimeControl.java index fc19321c0a..bb76d0075d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorWithTimeControl.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorWithTimeControl.java @@ -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 modTimes = new TreeSet(); + private TreeSet modTimes; public FileTreeIteratorWithTimeControl(FileTreeIterator p, Repository repo, TreeSet 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 head = modTimes.headSet(cutOff); return head.isEmpty() ? 0 : head.last().longValue(); } -- 2.39.5