mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +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:
		| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user