mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-31 21:00:02 +02:00
Move PushUpdate dependency from models to repofiles (#6763)
* remove push_update * move models.PushUpdate to repofiles.PushUpdate
This commit is contained in:
parent
b1be6fd31f
commit
d93e6232e8
7 changed files with 98 additions and 21 deletions
|
@ -15,6 +15,7 @@ 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/util"
|
||||
|
||||
macaron "gopkg.in/macaron.v1"
|
||||
|
@ -117,7 +118,15 @@ func HookPostReceive(ctx *macaron.Context) {
|
|||
// or other less-standard refs spaces are ignored since there
|
||||
// may be a very large number of them).
|
||||
if strings.HasPrefix(refFullName, git.BranchPrefix) || strings.HasPrefix(refFullName, git.TagPrefix) {
|
||||
if err := models.PushUpdate(branch, models.PushUpdateOptions{
|
||||
repo, err := models.GetRepositoryByOwnerAndName(ownerName, repoName)
|
||||
if err != nil {
|
||||
log.Error("Failed to get repository: %s/%s Error: %v", ownerName, repoName, err)
|
||||
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
|
||||
"err": fmt.Sprintf("Failed to get repository: %s/%s Error: %v", ownerName, repoName, err),
|
||||
})
|
||||
return
|
||||
}
|
||||
if err := repofiles.PushUpdate(repo, branch, models.PushUpdateOptions{
|
||||
RefFullName: refFullName,
|
||||
OldCommitID: oldCommitID,
|
||||
NewCommitID: newCommitID,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue