Fix onboard import cloning from empty new repo instead of archived repo

initial_import() now accepts an optional clone URL override parameter.
onboard_flow() passes the archived repo URL so content is cloned from
the right source.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-13 19:48:46 +03:00
parent cb14cf9bd4
commit 553f006174
2 changed files with 18 additions and 3 deletions

View File

@@ -200,9 +200,13 @@ reverse_sync() {
#
# Used when a subrepo already has content and you're adding it to the
# monorepo for the first time. Creates a PR.
# Usage: initial_import [clone_url_override]
# clone_url_override — if set, clone from this URL instead of subrepo_auth_url()
# (used by onboard to clone from the archived repo)
# Returns: skip | pr-created
initial_import() {
local clone_url="${1:-$(subrepo_auth_url)}"
local mono_branch="$SYNC_BRANCH_MONO"
local subrepo_branch="$SYNC_BRANCH_SUBREPO"
local subfolder
@@ -225,8 +229,8 @@ initial_import() {
--branch "$mono_branch" --single-branch \
"${work_dir}/monorepo" || die "Failed to clone monorepo"
# 2. Clone subrepo
git clone "$(subrepo_auth_url)" \
# 2. Clone subrepo (or archived repo when clone_url is overridden)
git clone "$clone_url" \
--branch "$subrepo_branch" --single-branch \
"${work_dir}/subrepo" || die "Failed to clone subrepo"