@@ -142,8 +142,8 @@ func preReceiveBranch(ctx *preReceiveContext, oldCommitID, newCommitID, refFullN
142
142
return
143
143
}
144
144
145
- repo := ctx .Repo . Repository
146
- gitRepo := ctx .Repo . GitRepo
145
+ repo := ctx .Repository
146
+ gitRepo := ctx .GitRepo
147
147
branchName := strings .TrimPrefix (refFullName , git .BranchPrefix )
148
148
149
149
if branchName == repo .DefaultBranch && newCommitID == git .EmptySHA {
@@ -363,9 +363,9 @@ func preReceiveTag(ctx *preReceiveContext, oldCommitID, newCommitID, refFullName
363
363
364
364
if ! ctx .gotProtectedTags {
365
365
var err error
366
- ctx .protectedTags , err = ctx .Repo . Repository .GetProtectedTags ()
366
+ ctx .protectedTags , err = ctx .Repository .GetProtectedTags ()
367
367
if err != nil {
368
- log .Error ("Unable to get protected tags for %-v Error: %v" , ctx .Repo . Repository , err )
368
+ log .Error ("Unable to get protected tags for %-v Error: %v" , ctx .Repository , err )
369
369
ctx .JSON (http .StatusInternalServerError , private.Response {
370
370
Err : err .Error (),
371
371
})
@@ -382,7 +382,7 @@ func preReceiveTag(ctx *preReceiveContext, oldCommitID, newCommitID, refFullName
382
382
return
383
383
}
384
384
if ! isAllowed {
385
- log .Warn ("Forbidden: Tag %s in %-v is protected" , tagName , ctx .Repo . Repository )
385
+ log .Warn ("Forbidden: Tag %s in %-v is protected" , tagName , ctx .Repository )
386
386
ctx .JSON (http .StatusForbidden , private.Response {
387
387
Err : fmt .Sprintf ("Tag %s is protected" , tagName ),
388
388
})
@@ -395,7 +395,7 @@ func preReceivePullRequest(ctx *preReceiveContext, oldCommitID, newCommitID, ref
395
395
return
396
396
}
397
397
398
- if ctx .Repo . Repository .IsEmpty {
398
+ if ctx .Repository .IsEmpty {
399
399
ctx .JSON (http .StatusForbidden , map [string ]interface {}{
400
400
"err" : "Can't create pull request for an empty repository." ,
401
401
})
@@ -412,13 +412,13 @@ func preReceivePullRequest(ctx *preReceiveContext, oldCommitID, newCommitID, ref
412
412
baseBranchName := refFullName [len (git .PullRequestPrefix ):]
413
413
414
414
baseBranchExist := false
415
- if ctx .Repo . GitRepo .IsBranchExist (baseBranchName ) {
415
+ if ctx .GitRepo .IsBranchExist (baseBranchName ) {
416
416
baseBranchExist = true
417
417
}
418
418
419
419
if ! baseBranchExist {
420
420
for p , v := range baseBranchName {
421
- if v == '/' && ctx .Repo . GitRepo .IsBranchExist (baseBranchName [:p ]) && p != len (baseBranchName )- 1 {
421
+ if v == '/' && ctx .GitRepo .IsBranchExist (baseBranchName [:p ]) && p != len (baseBranchName )- 1 {
422
422
baseBranchExist = true
423
423
break
424
424
}
@@ -460,11 +460,11 @@ func loadUserAndPermission(ctx *gitea_context.PrivateContext, id int64) (user *u
460
460
return
461
461
}
462
462
463
- perm , err = models .GetUserRepoPermission (ctx .Repo . Repository , user )
463
+ perm , err = models .GetUserRepoPermission (ctx .Repository , user )
464
464
if err != nil {
465
- log .Error ("Unable to get Repo permission of repo %s/%s of User %s" , ctx .Repo . Repository .OwnerName , ctx . Repo .Repository .Name , user .Name , err )
465
+ log .Error ("Unable to get Repo permission of repo %s/%s of User %s" , ctx .Repository .OwnerName , ctx .Repository .Name , user .Name , err )
466
466
ctx .JSON (http .StatusInternalServerError , private.Response {
467
- Err : fmt .Sprintf ("Unable to get Repo permission of repo %s/%s of User %s: %v" , ctx .Repo . Repository .OwnerName , ctx . Repo .Repository .Name , user .Name , err ),
467
+ Err : fmt .Sprintf ("Unable to get Repo permission of repo %s/%s of User %s: %v" , ctx .Repository .OwnerName , ctx .Repository .Name , user .Name , err ),
468
468
})
469
469
return
470
470
}
0 commit comments