MDL-47729 repositories: smarter sync of references

It was noticed that if file content was once imported the following
synchronisations do not discover the changes