From e80a8843f2a712feb002c9135d850ab8cf2d2301 Mon Sep 17 00:00:00 2001 From: Abdulrhmn Ghanem Date: Wed, 28 Sep 2022 22:12:18 +0200 Subject: [PATCH] squash! processor: add another condition to `waitForRepoMigration` --- processor/src/watcher.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/processor/src/watcher.ts b/processor/src/watcher.ts index e9202485ef..2eacdb8ed0 100644 --- a/processor/src/watcher.ts +++ b/processor/src/watcher.ts @@ -41,13 +41,8 @@ export function watch(repoDir, { giteaDB }: WatchOptions) { dirWatchers[gitDir].queuing = false return } - defaultBranch = giteaRepo.default_branch - originalUrl = giteaRepo.original_url - repoDescription = giteaRepo.description + giteaId = giteaRepo.id - // use case-correct names from the DB - ownerName = giteaRepo.owner_name - repoName = giteaRepo.name if (giteaRepo.is_empty) { await giteaDB.waitForNonEmpty(giteaId) @@ -56,6 +51,16 @@ export function watch(repoDir, { giteaDB }: WatchOptions) { if (giteaRepo.is_mirror) { await giteaDB.waitForRepoMigration(giteaId) } + + // Get the repo info again after the migration is done. + // Some fields, (e.g., default_branch) only gets populated after migration + const finalGiteaRepoData = await giteaDB.getRepoInfo(ownerName, repoName) + originalUrl = finalGiteaRepoData.original_url + repoDescription = finalGiteaRepoData.description + defaultBranch = finalGiteaRepoData.default_branch + // use case-correct names from the DB + ownerName = finalGiteaRepoData.owner_name + repoName = finalGiteaRepoData.name } await addProjectToQueues({