mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Refactor names (#31405)
This PR only does "renaming": * `Route` should be `Router` (and chi router is also called "router") * `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`) * Use lower case for private functions to avoid exposing or abusing
This commit is contained in:
@@ -25,8 +25,8 @@ var tplCherryPick base.TplName = "repo/editor/cherry_pick"
|
||||
|
||||
// CherryPick handles cherrypick GETs
|
||||
func CherryPick(ctx *context.Context) {
|
||||
ctx.Data["SHA"] = ctx.Params(":sha")
|
||||
cherryPickCommit, err := ctx.Repo.GitRepo.GetCommit(ctx.Params(":sha"))
|
||||
ctx.Data["SHA"] = ctx.PathParam(":sha")
|
||||
cherryPickCommit, err := ctx.Repo.GitRepo.GetCommit(ctx.PathParam(":sha"))
|
||||
if err != nil {
|
||||
if git.IsErrNotExist(err) {
|
||||
ctx.NotFound("Missing Commit", err)
|
||||
@@ -38,7 +38,7 @@ func CherryPick(ctx *context.Context) {
|
||||
|
||||
if ctx.FormString("cherry-pick-type") == "revert" {
|
||||
ctx.Data["CherryPickType"] = "revert"
|
||||
ctx.Data["commit_summary"] = "revert " + ctx.Params(":sha")
|
||||
ctx.Data["commit_summary"] = "revert " + ctx.PathParam(":sha")
|
||||
ctx.Data["commit_message"] = "revert " + cherryPickCommit.Message()
|
||||
} else {
|
||||
ctx.Data["CherryPickType"] = "cherry-pick"
|
||||
@@ -67,7 +67,7 @@ func CherryPick(ctx *context.Context) {
|
||||
func CherryPickPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*forms.CherryPickForm)
|
||||
|
||||
sha := ctx.Params(":sha")
|
||||
sha := ctx.PathParam(":sha")
|
||||
ctx.Data["SHA"] = sha
|
||||
if form.Revert {
|
||||
ctx.Data["CherryPickType"] = "revert"
|
||||
@@ -141,7 +141,7 @@ func CherryPickPost(ctx *context.Context) {
|
||||
if form.Revert {
|
||||
if err := git.GetReverseRawDiff(ctx, ctx.Repo.Repository.RepoPath(), sha, buf); err != nil {
|
||||
if git.IsErrNotExist(err) {
|
||||
ctx.NotFound("GetRawDiff", errors.New("commit "+ctx.Params(":sha")+" does not exist."))
|
||||
ctx.NotFound("GetRawDiff", errors.New("commit "+ctx.PathParam(":sha")+" does not exist."))
|
||||
return
|
||||
}
|
||||
ctx.ServerError("GetRawDiff", err)
|
||||
@@ -150,7 +150,7 @@ func CherryPickPost(ctx *context.Context) {
|
||||
} else {
|
||||
if err := git.GetRawDiff(ctx.Repo.GitRepo, sha, git.RawDiffType("patch"), buf); err != nil {
|
||||
if git.IsErrNotExist(err) {
|
||||
ctx.NotFound("GetRawDiff", errors.New("commit "+ctx.Params(":sha")+" does not exist."))
|
||||
ctx.NotFound("GetRawDiff", errors.New("commit "+ctx.PathParam(":sha")+" does not exist."))
|
||||
return
|
||||
}
|
||||
ctx.ServerError("GetRawDiff", err)
|
||||
|
Reference in New Issue
Block a user