aboutsummaryrefslogtreecommitdiff
path: root/routers/api/v1/repo/branch.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-06-03 07:26:09 -0400
committerUnknwon <u@gogs.io>2017-06-03 07:26:09 -0400
commit2478b874320ed91d4424dea42a40aacbd2b1ce1c (patch)
treedbaf2a482ffc43b5013aa08c83c686698ab181c1 /routers/api/v1/repo/branch.go
parente33c714073cc65f814bacf604a84cd2741951afa (diff)
Refactoring: rename ctx -> c
Diffstat (limited to 'routers/api/v1/repo/branch.go')
-rw-r--r--routers/api/v1/repo/branch.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/routers/api/v1/repo/branch.go b/routers/api/v1/repo/branch.go
index df950040..3d5e646c 100644
--- a/routers/api/v1/repo/branch.go
+++ b/routers/api/v1/repo/branch.go
@@ -13,43 +13,43 @@ import (
)
// https://github.com/gogits/go-gogs-client/wiki/Repositories#get-branch
-func GetBranch(ctx *context.APIContext) {
- branch, err := ctx.Repo.Repository.GetBranch(ctx.Params("*"))
+func GetBranch(c *context.APIContext) {
+ branch, err := c.Repo.Repository.GetBranch(c.Params("*"))
if err != nil {
if models.IsErrBranchNotExist(err) {
- ctx.Error(404, "GetBranch", err)
+ c.Error(404, "GetBranch", err)
} else {
- ctx.Error(500, "GetBranch", err)
+ c.Error(500, "GetBranch", err)
}
return
}
- c, err := branch.GetCommit()
+ commit, err := branch.GetCommit()
if err != nil {
- ctx.Error(500, "GetCommit", err)
+ c.Error(500, "GetCommit", err)
return
}
- ctx.JSON(200, convert.ToBranch(branch, c))
+ c.JSON(200, convert.ToBranch(branch, commit))
}
// https://github.com/gogits/go-gogs-client/wiki/Repositories#list-branches
-func ListBranches(ctx *context.APIContext) {
- branches, err := ctx.Repo.Repository.GetBranches()
+func ListBranches(c *context.APIContext) {
+ branches, err := c.Repo.Repository.GetBranches()
if err != nil {
- ctx.Error(500, "GetBranches", err)
+ c.Error(500, "GetBranches", err)
return
}
apiBranches := make([]*api.Branch, len(branches))
for i := range branches {
- c, err := branches[i].GetCommit()
+ commit, err := branches[i].GetCommit()
if err != nil {
- ctx.Error(500, "GetCommit", err)
+ c.Error(500, "GetCommit", err)
return
}
- apiBranches[i] = convert.ToBranch(branches[i], c)
+ apiBranches[i] = convert.ToBranch(branches[i], commit)
}
- ctx.JSON(200, &apiBranches)
+ c.JSON(200, &apiBranches)
}