diff options
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java index 064100839e..b335f2d43a 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java @@ -64,6 +64,7 @@ import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectReader; import org.eclipse.jgit.lib.RepositoryTestCase; import org.eclipse.jgit.revwalk.RevCommit; +import org.eclipse.jgit.treewalk.WorkingTreeIterator.MetadataDiff; import org.eclipse.jgit.treewalk.filter.PathFilter; import org.eclipse.jgit.util.FileUtils; import org.eclipse.jgit.util.RawParseUtils; @@ -216,6 +217,27 @@ public class FileTreeIteratorTest extends RepositoryTestCase { } @Test + public void testIsModifiedFileSmudged() throws Exception { + File f = writeTrashFile("file", "content"); + Git git = new Git(db); + // The idea of this test is to check the smudged handling + // Hopefully fsTick will make sure our entry gets smudged + fsTick(f); + writeTrashFile("file", "content"); + git.add().addFilepattern("file").call(); + writeTrashFile("file", "conten2"); + 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 + // test and hope that we are usually testing the intended code path. + assertEquals(MetadataDiff.SMUDGED, fti.compareMetadata(dce)); + assertTrue(fti.isModified(dce, false)); + } + + @Test public void submoduleHeadMatchesIndex() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); |