MappingCopySpecVisitor.FileVisitDetailsImpl.copyTo appears to be chmod a file multiple times

When MappingCopySpecVisitor.FileVisitDetailsImpl.copyTo calls fileDetails.copyTo(target), AbstractFileTreeElement will perform a chmod as part of the copy. But then the MappingCopySpecVisitor.FileVisitDetailsImpl.copyTo calls a method called adaptPermissions which then chmod’s the file again. Admitally the logic in FileVisitDetailsImpl.getMode() means that fileDetails.getMode() could be different. So maybe it is easier to chmod multiple times. But, in the common case, the fileDetails.getMode() is the same as getMode() (in adaptPermissions), hence it could skip the duplicate chmod since it knows that it already happened. It should be a simple change, which has performance benefits since it would prevent potentially thousands of calls to Libc.