diff options
author | Unknwon <u@gogs.io> | 2017-02-17 15:10:50 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-02-17 15:10:50 -0500 |
commit | 7e09d210ba421a1baf03ef7ba8770bebe8d28b72 (patch) | |
tree | 1d209f6175c3e4d7e21c4bda62e65db0ac4608f5 /routers/repo/pull.go | |
parent | dab768212af15f4e671e5403ad3def455117f699 (diff) |
Initial version of protected branches (#776)
- Able to restrict force push and deletion
- Able to restrict direct push
Diffstat (limited to 'routers/repo/pull.go')
-rw-r--r-- | routers/repo/pull.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go index db8d70db..faf3b789 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -711,6 +711,22 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm) ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pullIssue.Index)) } +func parseOwnerAndRepo(ctx *context.Context) (*models.User, *models.Repository) { + owner, err := models.GetUserByName(ctx.Params(":username")) + if err != nil { + ctx.NotFoundOrServerError("GetUserByName", models.IsErrUserNotExist, err) + return nil, nil + } + + repo, err := models.GetRepositoryByName(owner.ID, ctx.Params(":reponame")) + if err != nil { + ctx.NotFoundOrServerError("GetRepositoryByName", models.IsErrRepoNotExist, err) + return nil, nil + } + + return owner, repo +} + func TriggerTask(ctx *context.Context) { pusherID := ctx.QueryInt64("pusher") branch := ctx.Query("branch") |