|
|
@ -76,10 +76,11 @@ public class InterIndexDiffFilterTest extends LocalDiskRepositoryTestCase { |
|
|
|
public void testEmpty() throws IOException { |
|
|
|
public void testEmpty() throws IOException { |
|
|
|
DirCache dc1 = DirCache.newInCore(); |
|
|
|
DirCache dc1 = DirCache.newInCore(); |
|
|
|
DirCache dc2 = DirCache.newInCore(); |
|
|
|
DirCache dc2 = DirCache.newInCore(); |
|
|
|
TreeWalk tw = new TreeWalk(db); |
|
|
|
try (TreeWalk tw = new TreeWalk(db)) { |
|
|
|
tw.addTree(new DirCacheIterator(dc1)); |
|
|
|
tw.addTree(new DirCacheIterator(dc1)); |
|
|
|
tw.addTree(new DirCacheIterator(dc2)); |
|
|
|
tw.addTree(new DirCacheIterator(dc2)); |
|
|
|
assertFalse(tw.next()); |
|
|
|
assertFalse(tw.next()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static final class AddEdit extends PathEdit { |
|
|
|
static final class AddEdit extends PathEdit { |
|
|
@ -124,14 +125,15 @@ public class InterIndexDiffFilterTest extends LocalDiskRepositoryTestCase { |
|
|
|
editor.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("a"), 1, false)); |
|
|
|
editor.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("a"), 1, false)); |
|
|
|
editor.finish(); |
|
|
|
editor.finish(); |
|
|
|
|
|
|
|
|
|
|
|
TreeWalk tw = new TreeWalk(db); |
|
|
|
try (TreeWalk tw = new TreeWalk(db)) { |
|
|
|
tw.setRecursive(true); |
|
|
|
tw.setRecursive(true); |
|
|
|
tw.addTree(new DirCacheIterator(dc1)); |
|
|
|
tw.addTree(new DirCacheIterator(dc1)); |
|
|
|
tw.addTree(new DirCacheIterator(dc2)); |
|
|
|
tw.addTree(new DirCacheIterator(dc2)); |
|
|
|
tw.setFilter(InterIndexDiffFilter.INSTANCE); |
|
|
|
tw.setFilter(InterIndexDiffFilter.INSTANCE); |
|
|
|
assertTrue(tw.next()); |
|
|
|
assertTrue(tw.next()); |
|
|
|
assertEquals("a/a", tw.getPathString()); |
|
|
|
assertEquals("a/a", tw.getPathString()); |
|
|
|
assertFalse(tw.next()); |
|
|
|
assertFalse(tw.next()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -145,13 +147,14 @@ public class InterIndexDiffFilterTest extends LocalDiskRepositoryTestCase { |
|
|
|
ed2.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("a"), 1, false)); |
|
|
|
ed2.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("a"), 1, false)); |
|
|
|
ed2.finish(); |
|
|
|
ed2.finish(); |
|
|
|
|
|
|
|
|
|
|
|
TreeWalk tw = new TreeWalk(db); |
|
|
|
try (TreeWalk tw = new TreeWalk(db)) { |
|
|
|
tw.setRecursive(true); |
|
|
|
tw.setRecursive(true); |
|
|
|
tw.addTree(new DirCacheIterator(dc1)); |
|
|
|
tw.addTree(new DirCacheIterator(dc1)); |
|
|
|
tw.addTree(new DirCacheIterator(dc2)); |
|
|
|
tw.addTree(new DirCacheIterator(dc2)); |
|
|
|
tw.setFilter(InterIndexDiffFilter.INSTANCE); |
|
|
|
tw.setFilter(InterIndexDiffFilter.INSTANCE); |
|
|
|
|
|
|
|
|
|
|
|
assertFalse(tw.next()); |
|
|
|
assertFalse(tw.next()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -165,15 +168,16 @@ public class InterIndexDiffFilterTest extends LocalDiskRepositoryTestCase { |
|
|
|
ed2.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("a"), 1, true)); |
|
|
|
ed2.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("a"), 1, true)); |
|
|
|
ed2.finish(); |
|
|
|
ed2.finish(); |
|
|
|
|
|
|
|
|
|
|
|
TreeWalk tw = new TreeWalk(db); |
|
|
|
try (TreeWalk tw = new TreeWalk(db)) { |
|
|
|
tw.setRecursive(true); |
|
|
|
tw.setRecursive(true); |
|
|
|
tw.addTree(new DirCacheIterator(dc1)); |
|
|
|
tw.addTree(new DirCacheIterator(dc1)); |
|
|
|
tw.addTree(new DirCacheIterator(dc2)); |
|
|
|
tw.addTree(new DirCacheIterator(dc2)); |
|
|
|
tw.setFilter(InterIndexDiffFilter.INSTANCE); |
|
|
|
tw.setFilter(InterIndexDiffFilter.INSTANCE); |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(tw.next()); |
|
|
|
assertTrue(tw.next()); |
|
|
|
assertEquals("a/a", tw.getPathString()); |
|
|
|
assertEquals("a/a", tw.getPathString()); |
|
|
|
assertFalse(tw.next()); |
|
|
|
assertFalse(tw.next()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -188,12 +192,13 @@ public class InterIndexDiffFilterTest extends LocalDiskRepositoryTestCase { |
|
|
|
ed2.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("b"), 1, true)); |
|
|
|
ed2.add(new AddEdit("a/a", FileMode.REGULAR_FILE, id("b"), 1, true)); |
|
|
|
ed2.finish(); |
|
|
|
ed2.finish(); |
|
|
|
|
|
|
|
|
|
|
|
TreeWalk tw = new TreeWalk(db); |
|
|
|
try (TreeWalk tw = new TreeWalk(db)) { |
|
|
|
tw.setRecursive(true); |
|
|
|
tw.setRecursive(true); |
|
|
|
tw.addTree(new DirCacheIterator(dc1)); |
|
|
|
tw.addTree(new DirCacheIterator(dc1)); |
|
|
|
tw.addTree(new DirCacheIterator(dc2)); |
|
|
|
tw.addTree(new DirCacheIterator(dc2)); |
|
|
|
tw.setFilter(InterIndexDiffFilter.INSTANCE); |
|
|
|
tw.setFilter(InterIndexDiffFilter.INSTANCE); |
|
|
|
|
|
|
|
|
|
|
|
assertFalse(tw.next()); |
|
|
|
assertFalse(tw.next()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|