Geo secondary creates empty repositories where the primary has no repository
The following discussion from !4757 (merged) should be addressed:
-
@nick.thomas started a discussion: So here's a weirdness.
In the case where no repository exists on the primary, we create an empty repository on the secondary.
I don't think we can sensibly address it in this MR, but it's something for a follow-up, for sure.
Geo::BaseSyncService handles the case where no repository exists on the primary fairly badly.
- We create empty repositories, even when no matching repository exists on the primary
- We (since merging !4757 (merged)) search
git fetcherror messages relating to "no repository" and mark the sync as successful if we see that text.
Both of these issues can be alleviated by adding an API endpoint in the primary to check whether a given project or wiki repository exists on disk.
If no repository exists on disk on the secondary, Geo::BaseSyncService can call this endpoint. If it says no repository exists on the primary, then we can mark the sync as completed and exit.
If it says a repository does exist, we run ensure_repository ; fetch_remote on the secondary, which will prevent us from hitting the endpoint repeatedly for a single repository.
I don't think there's much sensible we can do to clean up the repositories we've already created on the secondary.