Merge "Reset internal state canonical length in WorkingTreeIterator when moving"
This commit is contained in:
commit
08fd639c0d
|
@ -56,9 +56,9 @@
|
|||
import org.eclipse.jgit.dircache.DirCache;
|
||||
import org.eclipse.jgit.dircache.DirCacheCheckout;
|
||||
import org.eclipse.jgit.dircache.DirCacheEditor;
|
||||
import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
|
||||
import org.eclipse.jgit.dircache.DirCacheEntry;
|
||||
import org.eclipse.jgit.dircache.DirCacheIterator;
|
||||
import org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;
|
||||
import org.eclipse.jgit.errors.CorruptObjectException;
|
||||
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
|
||||
import org.eclipse.jgit.errors.MissingObjectException;
|
||||
|
@ -98,6 +98,19 @@ public void setUp() throws Exception {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetEntryContentLength() throws Exception {
|
||||
final FileTreeIterator fti = new FileTreeIterator(db);
|
||||
fti.next(1);
|
||||
assertEquals(3, fti.getEntryContentLength());
|
||||
fti.back(1);
|
||||
assertEquals(2, fti.getEntryContentLength());
|
||||
fti.next(1);
|
||||
assertEquals(3, fti.getEntryContentLength());
|
||||
fti.reset();
|
||||
assertEquals(2, fti.getEntryContentLength());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyIfRootIsFile() throws Exception {
|
||||
final File r = new File(trash, paths[0]);
|
||||
|
|
|
@ -465,7 +465,6 @@ public boolean eof() {
|
|||
public void next(final int delta) throws CorruptObjectException {
|
||||
ptr += delta;
|
||||
if (!eof()) {
|
||||
canonLen = -1;
|
||||
parseEntry();
|
||||
}
|
||||
}
|
||||
|
@ -484,6 +483,7 @@ private void parseEntry() {
|
|||
ensurePathCapacity(pathOffset + nameLen, pathOffset);
|
||||
System.arraycopy(e.encodedName, 0, path, pathOffset, nameLen);
|
||||
pathLen = pathOffset + nameLen;
|
||||
canonLen = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue