What does LinkRepository do if the repo is already linked to a different pool?
Suppose GitLab thinks repo A is linked to pool P1, but in Gitaly A is linked to P2. Now GitLab calls LinkRepository(A, P1) to be sure it's linked. If some of A's objects are in P2, then now A has lost data.
I think at the very least, we should have an error in this case. I don't know if that is true for the current implementation; this issue is here for us to check that and if necessary fix it.