diff options
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java | 25 |
1 files changed, 25 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 2cdaea28de..209b2b8377 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 @@ -198,6 +198,31 @@ public class FileTreeIteratorTest extends RepositoryTestCase { } @Test + public void testDirCacheMatchingId() throws Exception { + File f = writeTrashFile("file", "content"); + Git git = new Git(db); + writeTrashFile("file", "content"); + fsTick(f); + git.add().addFilepattern("file").call(); + DirCacheEntry dce = db.readDirCache().getEntry("file"); + TreeWalk tw = new TreeWalk(db); + FileTreeIterator fti = new FileTreeIterator(trash, db.getFS(), db + .getConfig().get(WorkingTreeOptions.KEY)); + tw.addTree(fti); + DirCacheIterator dci = new DirCacheIterator(db.readDirCache()); + tw.addTree(dci); + fti.setDirCacheIterator(tw, 1); + while (tw.next() && !tw.getPathString().equals("file")) { + // + } + assertEquals(MetadataDiff.EQUAL, fti.compareMetadata(dce)); + ObjectId fromRaw = ObjectId.fromRaw(fti.idBuffer(), fti.idOffset()); + assertEquals("6b584e8ece562ebffc15d38808cd6b98fc3d97ea", + fromRaw.getName()); + assertFalse(fti.isModified(dce, false)); + } + + @Test public void testIsModifiedSymlink() throws Exception { File f = writeTrashFile("symlink", "content"); Git git = new Git(db); |