Refactoring repositorydiscovery in response to GH discussion
Added sync-if-requested