Consider sym- or hardlinks when comparing files

Trying to transfer the pull request to the new repository. Please ignore if it fails.