package org.eclipse.jgit.dircache;
import java.io.IOException;
-import java.util.Arrays;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.lib.Constants;
return new EmptyTreeIterator(this, n, pathLen + 1);
}
+ @Override
+ public boolean hasId() {
+ if (currentSubtree != null)
+ return currentSubtree.isValid();
+ return currentEntry != null;
+ }
+
@Override
public byte[] idBuffer() {
if (currentSubtree != null)
- return subtreeId;
+ return currentSubtree.isValid() ? subtreeId : zeroid;
if (currentEntry != null)
return currentEntry.idBuffer();
return zeroid;
if (s.isValid())
s.getObjectId().copyRawTo(subtreeId, 0);
- else
- Arrays.fill(subtreeId, (byte) 0);
mode = FileMode.TREE.getBits();
path = cep;
pathLen = pathOffset + s.nameLength();
final AbstractTreeIterator ch = currentHead;
final AbstractTreeIterator a = trees[nthA];
final AbstractTreeIterator b = trees[nthB];
- if (a.matches == ch && b.matches == ch)
- return a.idEqual(b);
if (a.matches != ch && b.matches != ch) {
// If neither tree matches the current path node then neither
// tree has this entry. In such case the ObjectId is zero(),
//
return true;
}
+ if (!a.hasId() || !b.hasId())
+ return false;
+ if (a.matches == ch && b.matches == ch)
+ return a.idEqual(b);
return false;
}
ignoreNode = new RootIgnoreNode(entry, repo);
}
+ @Override
+ public boolean hasId() {
+ if (contentIdFromPtr == ptr)
+ return true;
+ return (mode & FileMode.TYPE_MASK) == FileMode.TYPE_FILE;
+ }
+
@Override
public byte[] idBuffer() {
if (contentIdFromPtr == ptr)