in src/main/java/org/apache/sling/fsprovider/internal/FileMonitor.java [271:290]
private List<ResourceChange> collectResourceChanges(final Monitorable monitorable, final ChangeType changeType) {
List<ResourceChange> changes = new ArrayList<>();
if (monitorable.status instanceof ContentFileStatus) {
ContentFile contentFile = ((ContentFileStatus)monitorable.status).contentFile;
if (changeType == ChangeType.CHANGED) {
ContentElement content = contentFile.getContent();
// we cannot easily report the diff of resource changes between two content files
// so we simulate a removal of the toplevel node and then add all nodes contained in the current content file again.
changes.add(buildContentResourceChange(ChangeType.REMOVED, transformPath(monitorable.path)));
addContentResourceChanges(changes, ChangeType.ADDED, content, transformPath(monitorable.path));
}
else {
addContentResourceChanges(changes, changeType, contentFile.getContent(), transformPath(monitorable.path));
}
}
else {
changes.add(buildContentResourceChange(changeType, transformPath(monitorable.path)));
}
return changes;
}