Skip to content

Commit

Permalink
Revert "squash! processor: add another condition to `waitForRepoMigra…
Browse files Browse the repository at this point in the history
…tion`"

This reverts commit ce2589f.
  • Loading branch information
AbdulrhmnGhanem committed Sep 28, 2022
1 parent ce2589f commit 36d48f0
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions processor/src/watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ export function watch(repoDir, { giteaDB }: WatchOptions) {
let originalUrl = ''

if (giteaDB != null) {
let giteaRepo = await giteaDB.getRepoInfo(ownerName, repoName)
const giteaRepo = await giteaDB.getRepoInfo(ownerName, repoName)
if (giteaRepo == null) {
log.error(`${ownerName}/${repoName} is not in giteaDB`)
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)
Expand All @@ -49,17 +56,6 @@ 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.
giteaRepo = await giteaDB.getRepoInfo(ownerName, repoName)

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
}

await addProjectToQueues({
Expand Down

0 comments on commit 36d48f0

Please sign in to comment.