pub async fn plan_registration(
client: &ApiClient,
git_url: &str,
repo_name: &str,
preferred: Option<Uuid>,
) -> Result<RegistrationPlan, Box<dyn Error>>Expand description
Decide whether init/sync may register a repo for git_url.
Registration upserts by repo NAME (the checkout’s directory name), so a
checkout named differently from the remote’s existing repo record would
create a second record for the same codebase — and sessions then split
between the two (VIS-1018). So when the codebase already has live repos,
bind one of them: preferred (the repo the checkout’s config.toml already
names) if the codebase links it, else the one named repo_name, else the
only one; several and none of those → RegistrationPlan::Ambiguous.