diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-06-19 06:32:45 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-19 06:32:45 +0800 |
commit | 43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2 (patch) | |
tree | c98c2e1159ee02eb52282811f28a4c31ad222c67 /routers/web/repo/commit.go | |
parent | 17baf1af10de025a47ade1f16f1e5c51646d7fcf (diff) | |
download | gitea-43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2.tar.gz gitea-43c7a2e7b1c7fb8aa2347d82ad0a6886d6fad9c2.zip |
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
Diffstat (limited to 'routers/web/repo/commit.go')
-rw-r--r-- | routers/web/repo/commit.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go index 7b5e72593f..dae6063908 100644 --- a/routers/web/repo/commit.go +++ b/routers/web/repo/commit.go @@ -257,12 +257,12 @@ func FileHistory(ctx *context.Context) { } func LoadBranchesAndTags(ctx *context.Context) { - response, err := git_service.LoadBranchesAndTags(ctx, ctx.Repo, ctx.Params("sha")) + response, err := git_service.LoadBranchesAndTags(ctx, ctx.Repo, ctx.PathParam("sha")) if err == nil { ctx.JSON(http.StatusOK, response) return } - ctx.NotFoundOrServerError(fmt.Sprintf("could not load branches and tags the commit %s belongs to", ctx.Params("sha")), git.IsErrNotExist, err) + ctx.NotFoundOrServerError(fmt.Sprintf("could not load branches and tags the commit %s belongs to", ctx.PathParam("sha")), git.IsErrNotExist, err) } // Diff show different from current commit to previous commit @@ -271,7 +271,7 @@ func Diff(ctx *context.Context) { userName := ctx.Repo.Owner.Name repoName := ctx.Repo.Repository.Name - commitID := ctx.Params(":sha") + commitID := ctx.PathParam(":sha") var ( gitRepo *git.Repository err error @@ -420,13 +420,13 @@ func RawDiff(ctx *context.Context) { } if err := git.GetRawDiff( gitRepo, - ctx.Params(":sha"), - git.RawDiffType(ctx.Params(":ext")), + ctx.PathParam(":sha"), + git.RawDiffType(ctx.PathParam(":ext")), ctx.Resp, ); err != nil { if git.IsErrNotExist(err) { ctx.NotFound("GetRawDiff", - errors.New("commit "+ctx.Params(":sha")+" does not exist.")) + errors.New("commit "+ctx.PathParam(":sha")+" does not exist.")) return } ctx.ServerError("GetRawDiff", err) |