@@ -174,13 +174,6 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) {
174
174
return
175
175
}
176
176
177
- if ! repo .AllowsPulls () {
178
- // We can stop there's no need to go any further
179
- ctx .JSON (http .StatusOK , private.HookPostReceiveResult {
180
- RepoWasEmpty : wasEmpty ,
181
- })
182
- return
183
- }
184
177
baseRepo = repo
185
178
186
179
if repo .IsFork {
@@ -192,7 +185,17 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) {
192
185
})
193
186
return
194
187
}
195
- baseRepo = repo .BaseRepo
188
+ if repo .BaseRepo .AllowsPulls () {
189
+ baseRepo = repo .BaseRepo
190
+ }
191
+ }
192
+
193
+ if ! baseRepo .AllowsPulls () {
194
+ // We can stop there's no need to go any further
195
+ ctx .JSON (http .StatusOK , private.HookPostReceiveResult {
196
+ RepoWasEmpty : wasEmpty ,
197
+ })
198
+ return
196
199
}
197
200
}
198
201
@@ -218,14 +221,14 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) {
218
221
branch = fmt .Sprintf ("%s:%s" , repo .OwnerName , branch )
219
222
}
220
223
results = append (results , private.HookPostReceiveBranchResult {
221
- Message : setting .Git .PullRequestPushMessage && repo .AllowsPulls (),
224
+ Message : setting .Git .PullRequestPushMessage && baseRepo .AllowsPulls (),
222
225
Create : true ,
223
226
Branch : branch ,
224
227
URL : fmt .Sprintf ("%s/compare/%s...%s" , baseRepo .HTMLURL (), util .PathEscapeSegments (baseRepo .DefaultBranch ), util .PathEscapeSegments (branch )),
225
228
})
226
229
} else {
227
230
results = append (results , private.HookPostReceiveBranchResult {
228
- Message : setting .Git .PullRequestPushMessage && repo .AllowsPulls (),
231
+ Message : setting .Git .PullRequestPushMessage && baseRepo .AllowsPulls (),
229
232
Create : false ,
230
233
Branch : branch ,
231
234
URL : fmt .Sprintf ("%s/pulls/%d" , baseRepo .HTMLURL (), pr .Index ),
0 commit comments