@ -173,13 +173,6 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) {
return
}
if ! repo . AllowsPulls ( ) {
// We can stop there's no need to go any further
ctx . JSON ( http . StatusOK , private . HookPostReceiveResult {
RepoWasEmpty : wasEmpty ,
} )
return
}
baseRepo = repo
if repo . IsFork {
@ -191,7 +184,17 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) {
} )
return
}
baseRepo = repo . BaseRepo
if repo . BaseRepo . AllowsPulls ( ) {
baseRepo = repo . BaseRepo
}
}
if ! baseRepo . AllowsPulls ( ) {
// We can stop there's no need to go any further
ctx . JSON ( http . StatusOK , private . HookPostReceiveResult {
RepoWasEmpty : wasEmpty ,
} )
return
}
}
@ -217,14 +220,14 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) {
branch = fmt . Sprintf ( "%s:%s" , repo . OwnerName , branch )
}
results = append ( results , private . HookPostReceiveBranchResult {
Message : setting . Git . PullRequestPushMessage && r epo. AllowsPulls ( ) ,
Message : setting . Git . PullRequestPushMessage && baseR epo. AllowsPulls ( ) ,
Create : true ,
Branch : branch ,
URL : fmt . Sprintf ( "%s/compare/%s...%s" , baseRepo . HTMLURL ( ) , util . PathEscapeSegments ( baseRepo . DefaultBranch ) , util . PathEscapeSegments ( branch ) ) ,
} )
} else {
results = append ( results , private . HookPostReceiveBranchResult {
Message : setting . Git . PullRequestPushMessage && r epo. AllowsPulls ( ) ,
Message : setting . Git . PullRequestPushMessage && baseR epo. AllowsPulls ( ) ,
Create : false ,
Branch : branch ,
URL : fmt . Sprintf ( "%s/pulls/%d" , baseRepo . HTMLURL ( ) , pr . Index ) ,