summaryrefslogtreecommitdiffstats
path: root/routers/private/hook.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-09-11 22:14:48 +0800
committerGitHub <noreply@github.com>2020-09-11 10:14:48 -0400
commitdd1a651b5895cfdb8a141a56aa824ed4d082c41a (patch)
treec9d8f9adb0c0a9fb9af8623f1590275a395fa1c7 /routers/private/hook.go
parent910947fbcd229abac9f507e266f94cb8864474cb (diff)
downloadgitea-dd1a651b5895cfdb8a141a56aa824ed4d082c41a.tar.gz
gitea-dd1a651b5895cfdb8a141a56aa824ed4d082c41a.zip
Move all push update operations to a queue (#10133)
* Fix test * Add no queue for test only * improve code * Auto watch whatever branch operation * Fix lint * Rename noqueue to immediate * Remove old PushUpdate function * Fix tests Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'routers/private/hook.go')
-rw-r--r--routers/private/hook.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/private/hook.go b/routers/private/hook.go
index 2bccca3e3e..05f0b124c5 100644
--- a/routers/private/hook.go
+++ b/routers/private/hook.go
@@ -18,10 +18,10 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/private"
- "code.gitea.io/gitea/modules/repofiles"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
pull_service "code.gitea.io/gitea/services/pull"
+ repo_service "code.gitea.io/gitea/services/repository"
"gitea.com/macaron/macaron"
"github.com/go-git/go-git/v5/plumbing"
@@ -376,7 +376,7 @@ func HookPostReceive(ctx *macaron.Context, opts private.HookOptions) {
repoName := ctx.Params(":repo")
var repo *models.Repository
- updates := make([]*repofiles.PushUpdateOptions, 0, len(opts.OldCommitIDs))
+ updates := make([]*repo_service.PushUpdateOptions, 0, len(opts.OldCommitIDs))
wasEmpty := false
for i := range opts.OldCommitIDs {
@@ -403,7 +403,7 @@ func HookPostReceive(ctx *macaron.Context, opts private.HookOptions) {
wasEmpty = repo.IsEmpty
}
- option := repofiles.PushUpdateOptions{
+ option := repo_service.PushUpdateOptions{
RefFullName: refFullName,
OldCommitID: opts.OldCommitIDs[i],
NewCommitID: opts.NewCommitIDs[i],
@@ -422,7 +422,7 @@ func HookPostReceive(ctx *macaron.Context, opts private.HookOptions) {
}
if repo != nil && len(updates) > 0 {
- if err := repofiles.PushUpdates(repo, updates); err != nil {
+ if err := repo_service.PushUpdates(updates); err != nil {
log.Error("Failed to Update: %s/%s Total Updates: %d", ownerName, repoName, len(updates))
for i, update := range updates {
log.Error("Failed to Update: %s/%s Update: %d/%d: Branch: %s", ownerName, repoName, i, len(updates), update.BranchName())