summaryrefslogtreecommitdiffstats
path: root/modules/context/repo.go
diff options
context:
space:
mode:
authorSegev Finer <segev208@gmail.com>2019-04-15 23:48:35 +0300
committertechknowlogick <matti@mdranta.net>2019-04-15 16:48:35 -0400
commitecfa5f15944bc99f817222595ed793c526e268f8 (patch)
treec727f983ba327af954323e197d2adf1a3f63a07f /modules/context/repo.go
parent3fb038c53ad0e88997373ac87298a4bceadda867 (diff)
downloadgitea-ecfa5f15944bc99f817222595ed793c526e268f8.tar.gz
gitea-ecfa5f15944bc99f817222595ed793c526e268f8.zip
Fix forking an empty repository (#6637)
Fixes #6633 Signed-off-by: Segev Finer <segev@codeocean.com>
Diffstat (limited to 'modules/context/repo.go')
-rw-r--r--modules/context/repo.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/context/repo.go b/modules/context/repo.go
index 0cbd89a75f..2c6a4f5360 100644
--- a/modules/context/repo.go
+++ b/modules/context/repo.go
@@ -396,6 +396,13 @@ func RepoAssignment() macaron.Handler {
ctx.Data["IsStaringRepo"] = models.IsStaring(ctx.User.ID, repo.ID)
}
+ if repo.IsFork {
+ RetrieveBaseRepo(ctx, repo)
+ if ctx.Written() {
+ return
+ }
+ }
+
// repo is empty and display enable
if ctx.Repo.Repository.IsEmpty {
ctx.Data["BranchName"] = ctx.Repo.Repository.DefaultBranch
@@ -423,13 +430,6 @@ func RepoAssignment() macaron.Handler {
ctx.Data["BranchName"] = ctx.Repo.BranchName
ctx.Data["CommitID"] = ctx.Repo.CommitID
- if repo.IsFork {
- RetrieveBaseRepo(ctx, repo)
- if ctx.Written() {
- return
- }
- }
-
// People who have push access or have forked repository can propose a new pull request.
if ctx.Repo.CanWrite(models.UnitTypeCode) || (ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID)) {
// Pull request is allowed if this is a fork repository