summaryrefslogtreecommitdiffstats
path: root/models/repo_mirror.go
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2017-09-20 08:26:49 +0300
committerLunny Xiao <xiaolunwen@gmail.com>2017-09-20 13:26:49 +0800
commit7a0297819d3aececb8b633de5a2995c40b7bfcae (patch)
tree7aed967ad21f95df2b16359ec1551662d653a1fd /models/repo_mirror.go
parent8b6236d67b21f2a3291207ef77d103a3ce7476ba (diff)
downloadgitea-7a0297819d3aececb8b633de5a2995c40b7bfcae.tar.gz
gitea-7a0297819d3aececb8b633de5a2995c40b7bfcae.zip
Sync releases table with tags on push and for mirrors (#2459)
* Sync releases table with tags on push and for mirrors * Code style fixes * Fix api to return only releases * Optimize release creation and update Minimize posibility of race conditions * Fix release lower tag name updating * handle tag reference update by addionally comparing commit id
Diffstat (limited to 'models/repo_mirror.go')
-rw-r--r--models/repo_mirror.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/repo_mirror.go b/models/repo_mirror.go
index 526b7cd02e..60d4f9f05a 100644
--- a/models/repo_mirror.go
+++ b/models/repo_mirror.go
@@ -13,6 +13,7 @@ import (
"github.com/go-xorm/xorm"
"gopkg.in/ini.v1"
+ "code.gitea.io/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/setting"
@@ -156,6 +157,15 @@ func (m *Mirror) runSync() bool {
return false
}
+ gitRepo, err := git.OpenRepository(repoPath)
+ if err != nil {
+ log.Error(4, "OpenRepository: %v", err)
+ return false
+ }
+ if err = SyncReleasesWithTags(m.Repo, gitRepo); err != nil {
+ log.Error(4, "Failed to synchronize tags to releases for repository: %v", err)
+ }
+
if err := m.Repo.UpdateSize(); err != nil {
log.Error(4, "Failed to update size for mirror repository: %v", err)
}