Fixes #4767 detect hard links and set state in add_file_info