@@ -323,37 +323,6 @@ func RepoAssignment(args ...bool) macaron.Handler {
323
323
ctx .Data ["BranchName" ] = ctx .Repo .BranchName
324
324
ctx .Data ["CommitID" ] = ctx .Repo .CommitID
325
325
326
- if repo .IsFork {
327
- RetrieveBaseRepo (ctx , repo )
328
- if ctx .Written () {
329
- return
330
- }
331
- }
332
-
333
- // People who have push access or have fored repository can propose a new pull request.
334
- if ctx .Repo .IsWriter () || (ctx .IsSigned && ctx .User .HasForkedRepo (ctx .Repo .Repository .ID )) {
335
- // Pull request is allowed if this is a fork repository
336
- // and base repository accepts pull requests.
337
- if repo .BaseRepo != nil {
338
- if repo .BaseRepo .AllowsPulls () {
339
- ctx .Data ["BaseRepo" ] = repo .BaseRepo
340
- ctx .Repo .PullRequest .BaseRepo = repo .BaseRepo
341
- ctx .Repo .PullRequest .Allowed = true
342
- ctx .Repo .PullRequest .HeadInfo = ctx .Repo .Owner .Name + ":" + ctx .Repo .BranchName
343
- }
344
- } else {
345
- // Or, this is repository accepts pull requests between branches.
346
- if repo .AllowsPulls () {
347
- ctx .Data ["BaseRepo" ] = repo
348
- ctx .Repo .PullRequest .BaseRepo = repo
349
- ctx .Repo .PullRequest .Allowed = true
350
- ctx .Repo .PullRequest .SameRepo = true
351
- ctx .Repo .PullRequest .HeadInfo = ctx .Repo .BranchName
352
- }
353
- }
354
- }
355
- ctx .Data ["PullRequestCtx" ] = ctx .Repo .PullRequest
356
-
357
326
if ctx .Query ("go-get" ) == "1" {
358
327
ctx .Data ["GoGetImport" ] = composeGoGetImport (owner .Name , repo .Name )
359
328
prefix := setting .AppURL + path .Join (owner .Name , repo .Name , "src" , ctx .Repo .BranchName )
@@ -466,6 +435,37 @@ func RepoRef() macaron.Handler {
466
435
ctx .Data ["IsViewTag" ] = ctx .Repo .IsViewTag
467
436
ctx .Data ["IsViewCommit" ] = ctx .Repo .IsViewCommit
468
437
438
+ if ctx .Repo .Repository .IsFork {
439
+ RetrieveBaseRepo (ctx , ctx .Repo .Repository )
440
+ if ctx .Written () {
441
+ return
442
+ }
443
+ }
444
+
445
+ // People who have push access or have fored repository can propose a new pull request.
446
+ if ctx .Repo .IsWriter () || (ctx .IsSigned && ctx .User .HasForkedRepo (ctx .Repo .Repository .ID )) {
447
+ // Pull request is allowed if this is a fork repository
448
+ // and base repository accepts pull requests.
449
+ if ctx .Repo .Repository .BaseRepo != nil {
450
+ if ctx .Repo .Repository .BaseRepo .AllowsPulls () {
451
+ ctx .Data ["BaseRepo" ] = ctx .Repo .Repository .BaseRepo
452
+ ctx .Repo .PullRequest .BaseRepo = ctx .Repo .Repository .BaseRepo
453
+ ctx .Repo .PullRequest .Allowed = true
454
+ ctx .Repo .PullRequest .HeadInfo = ctx .Repo .Owner .Name + ":" + ctx .Repo .BranchName
455
+ }
456
+ } else {
457
+ // Or, this is repository accepts pull requests between branches.
458
+ if ctx .Repo .Repository .AllowsPulls () {
459
+ ctx .Data ["BaseRepo" ] = ctx .Repo .Repository
460
+ ctx .Repo .PullRequest .BaseRepo = ctx .Repo .Repository
461
+ ctx .Repo .PullRequest .Allowed = true
462
+ ctx .Repo .PullRequest .SameRepo = true
463
+ ctx .Repo .PullRequest .HeadInfo = ctx .Repo .BranchName
464
+ }
465
+ }
466
+ }
467
+ ctx .Data ["PullRequestCtx" ] = ctx .Repo .PullRequest
468
+
469
469
ctx .Repo .CommitsCount , err = ctx .Repo .Commit .CommitsCount ()
470
470
if err != nil {
471
471
ctx .Handle (500 , "CommitsCount" , err )
0 commit comments