aboutsummaryrefslogtreecommitdiff
path: root/routers/repo
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-02-25 03:52:54 -0500
committerUnknwon <u@gogs.io>2017-02-25 03:52:54 -0500
commit4d90527a6e6c963c0ebaf62acea23dc750100646 (patch)
treeef552ced69351ecae67ea3d82c5750a33fc8104e /routers/repo
parentc64b842df9d25f6a26abc8efab5d644a3e3cf716 (diff)
repo: does not allow fork to original owner (#4182)
But can still fork to organizations.
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/pull.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index 067e3c2a..f9b8866e 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -118,6 +118,12 @@ func ForkPost(ctx *context.Context, form auth.CreateRepoForm) {
}
}
+ // Cannot fork to same owner
+ if ctxUser.ID == forkRepo.OwnerID {
+ ctx.RenderWithErr(ctx.Tr("repo.settings.cannot_fork_to_same_owner"), FORK, &form)
+ return
+ }
+
repo, err := models.ForkRepository(ctxUser, forkRepo, form.RepoName, form.Description)
if err != nil {
ctx.Data["Err_RepoName"] = true