@@ -15,6 +15,7 @@ import (
15
15
"code.gitea.io/gitea/modules/git"
16
16
"code.gitea.io/gitea/modules/log"
17
17
"code.gitea.io/gitea/modules/private"
18
+ "code.gitea.io/gitea/modules/repofiles"
18
19
"code.gitea.io/gitea/modules/util"
19
20
20
21
macaron "gopkg.in/macaron.v1"
@@ -117,7 +118,15 @@ func HookPostReceive(ctx *macaron.Context) {
117
118
// or other less-standard refs spaces are ignored since there
118
119
// may be a very large number of them).
119
120
if strings .HasPrefix (refFullName , git .BranchPrefix ) || strings .HasPrefix (refFullName , git .TagPrefix ) {
120
- if err := models .PushUpdate (branch , models.PushUpdateOptions {
121
+ repo , err := models .GetRepositoryByOwnerAndName (ownerName , repoName )
122
+ if err != nil {
123
+ log .Error ("Failed to get repository: %s/%s Error: %v" , ownerName , repoName , err )
124
+ ctx .JSON (http .StatusInternalServerError , map [string ]interface {}{
125
+ "err" : fmt .Sprintf ("Failed to get repository: %s/%s Error: %v" , ownerName , repoName , err ),
126
+ })
127
+ return
128
+ }
129
+ if err := repofiles .PushUpdate (repo , branch , models.PushUpdateOptions {
121
130
RefFullName : refFullName ,
122
131
OldCommitID : oldCommitID ,
123
132
NewCommitID : newCommitID ,
0 commit comments