String path = toPath(file);
ObjectId blobId = null;
int modeBits = 0;
if (tree != null) {
TreeEntry entry = tree.findBlobMember(path);
if (entry != null) {
blobId = entry.getId();
modeBits = entry.getMode().getBits();
}
} else {
if (index == null)
index = DirCache.read(repository);
DirCacheEntry entry = index.getEntry(path);
if (entry != null) {
blobId = entry.getObjectId();
modeBits = entry.getRawMode();
}
}
if (blobId == null)
throw new FileNotFoundException(path);
fileMappings.put(RevisionEntry.create(path, blobId, modeBits), destination);