Browse Source

Fix FileTreeIteratorTest#testIsModifiedFileSmudged() on Windows

This would be a problem for any OS where Java lets the subscond
part through to the File API. The fix is to force the timetamp
of the index rather than trusting it to just happen to be right.

Bug: 430765
Change-Id: Id6b3ba003f58427a3ffaacd224649e2d6c93566b
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
stable-3.4
Robin Rosenberg 11 years ago committed by Robin Stocker
parent
commit
ecade47a89
  1. 5
      org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java

5
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java

@ -277,6 +277,11 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
git.add().addFilepattern("file").call();
writeTrashFile("file", "conten2");
f.setLastModified(lastModified);
// We cannot trust this to go fast enough on
// a system with less than one-second lastModified
// resolution, so we force the index to have the
// same timestamp as the file we look at.
db.getIndexFile().setLastModified(lastModified);
DirCacheEntry dce = db.readDirCache().getEntry("file");
FileTreeIterator fti = new FileTreeIterator(trash, db.getFS(), db
.getConfig().get(WorkingTreeOptions.KEY));

Loading…
Cancel
Save