0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-24 16:16:35 -05:00

fix data race on migrate repository (#5224)

This commit is contained in:
Lunny Xiao 2018-10-30 22:06:01 +08:00 committed by techknowlogick
parent 0ba57949e4
commit e61c6cd3db

View file

@ -1043,7 +1043,6 @@ func MigrateRepository(doer, u *User, opts MigrateRepoOptions) (*Repository, err
if err = SyncReleasesWithTags(repo, gitRepo); err != nil { if err = SyncReleasesWithTags(repo, gitRepo); err != nil {
log.Error(4, "Failed to synchronize tags to releases for repository: %v", err) log.Error(4, "Failed to synchronize tags to releases for repository: %v", err)
} }
UpdateRepoIndexer(repo)
} }
if err = repo.UpdateSize(); err != nil { if err = repo.UpdateSize(); err != nil {
@ -1061,10 +1060,16 @@ func MigrateRepository(doer, u *User, opts MigrateRepoOptions) (*Repository, err
} }
repo.IsMirror = true repo.IsMirror = true
return repo, UpdateRepository(repo, false) err = UpdateRepository(repo, false)
} else {
repo, err = CleanUpMigrateInfo(repo)
} }
return CleanUpMigrateInfo(repo) if err != nil && !repo.IsBare {
UpdateRepoIndexer(repo)
}
return repo, err
} }
// cleanUpMigrateGitConfig removes mirror info which prevents "push --all". // cleanUpMigrateGitConfig removes mirror info which prevents "push --all".