Fix forked repositories missed tags (#18719)

* Fix forked repositories missed tags

* Add missed close

* Use ctx

Co-authored-by: 6543 <6543@obermui.de>
tokarchuk/v1.17
Lunny Xiao 3 years ago committed by GitHub
parent 5aa4eeb180
commit 91ac65db5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      services/repository/fork.go

@ -143,7 +143,17 @@ func ForkRepository(doer, owner *user_model.User, opts ForkRepoOptions) (_ *repo
log.Error("Failed to update size for repository: %v", err) log.Error("Failed to update size for repository: %v", err)
} }
if err := repo_model.CopyLanguageStat(opts.BaseRepo, repo); err != nil { if err := repo_model.CopyLanguageStat(opts.BaseRepo, repo); err != nil {
log.Error("Copy language stat from oldRepo failed") log.Error("Copy language stat from oldRepo failed: %v", err)
}
gitRepo, err := git.OpenRepositoryCtx(git.DefaultContext, repo.RepoPath())
if err != nil {
log.Error("Open created git repository failed: %v", err)
} else {
defer gitRepo.Close()
if err := repo_module.SyncReleasesWithTags(repo, gitRepo); err != nil {
log.Error("Sync releases from git tags failed: %v", err)
}
} }
notification.NotifyForkRepository(doer, opts.BaseRepo, repo) notification.NotifyForkRepository(doer, opts.BaseRepo, repo)

Loading…
Cancel
Save