]> source.dussan.org Git - jgit.git/commitdiff
Attempt to stabilize FileTreeIterator test on Windows 53/9853/1
authorRobin Rosenberg <robin.rosenberg@dewire.com>
Wed, 23 Jan 2013 06:55:13 +0000 (07:55 +0100)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Wed, 23 Jan 2013 06:55:28 +0000 (07:55 +0100)
My guess is that the higher resolution of timestamps provided by Java on
Windows causes this test to occasionally fail.

Bug: 396662
Change-Id: Ia10d76e95fe6156c7ad05972619160e461606805

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

index bf22569dfbc9295938b50bc8c2850a0f8d7d0492..a416c742f8e7eb4edf3a52e0f589248e64e92d04 100644 (file)
@@ -253,14 +253,16 @@ public class FileTreeIteratorTest extends RepositoryTestCase {
                // Hopefully fsTick will make sure our entry gets smudged
                fsTick(f);
                writeTrashFile("file", "content");
+               long lastModified = f.lastModified();
                git.add().addFilepattern("file").call();
                writeTrashFile("file", "conten2");
+               f.setLastModified(lastModified);
                DirCacheEntry dce = db.readDirCache().getEntry("file");
                FileTreeIterator fti = new FileTreeIterator(trash, db.getFS(), db
                                .getConfig().get(WorkingTreeOptions.KEY));
                while (!fti.getEntryPathString().equals("file"))
                        fti.next(1);
-               // If the fsTick trick does not work we could skip the compareMetaData
+               // If the rounding trick does not work we could skip the compareMetaData
                // test and hope that we are usually testing the intended code path.
                assertEquals(MetadataDiff.SMUDGED, fti.compareMetadata(dce));
                assertTrue(fti.isModified(dce, false));