diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-02-12 11:18:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 11:18:06 +0800 |
commit | 91ac65db5ecac7c665b18a693720742434eb02cf (patch) | |
tree | 2f0f44655497280380ce3b00184d134ce4c74275 /services/repository | |
parent | 5aa4eeb1802cf0f0042a109e0c23a93d01dc84fb (diff) | |
download | gitea-91ac65db5ecac7c665b18a693720742434eb02cf.tar.gz gitea-91ac65db5ecac7c665b18a693720742434eb02cf.zip |
Fix forked repositories missed tags (#18719)
* Fix forked repositories missed tags
* Add missed close
* Use ctx
Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'services/repository')
-rw-r--r-- | services/repository/fork.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/services/repository/fork.go b/services/repository/fork.go index e592e477b3..ec8fb1a09e 100644 --- a/services/repository/fork.go +++ b/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) } 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) |