Browse Source

fix data race on migrate repository (#5224)

for-closed-social
Lunny Xiao 6 years ago
committed by techknowlogick
parent
commit
e61c6cd3db
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      models/repo.go

+ 8
- 3
models/repo.go 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)
}
if err != nil && !repo.IsBare {
UpdateRepoIndexer(repo)
} }
return CleanUpMigrateInfo(repo)
return repo, err
} }
// cleanUpMigrateGitConfig removes mirror info which prevents "push --all". // cleanUpMigrateGitConfig removes mirror info which prevents "push --all".

Loading…
Cancel
Save