diff --git a/routers/hat/repo/branch.go b/routers/hat/repo/branch.go index c2c2c3a..3d08d21 100644 --- a/routers/hat/repo/branch.go +++ b/routers/hat/repo/branch.go @@ -17,7 +17,6 @@ import ( func ListBranchesSlice(ctx *context.APIContext) { listOptions := utils.GetListOptions(ctx) - skip, _ := listOptions.GetStartEnd() branches, totalNumOfBranches, err := ctx.Repo.GitRepo.GetBranches(0, 0) if err != nil { @@ -55,15 +54,16 @@ func ListBranchesSlice(ctx *context.APIContext) { if branch.Name == ctx.Repo.Repository.DefaultBranch { apiBranches[i].BranchKind = int(git.DefaultBranch) } - sort.Sort(git.SortBranch(apiBranches)) - branchSlice := paginate(apiBranches, skip, listOptions.Page) - BranchesSlice := BranchesSliceByProtection(ctx, branchSlice) - ctx.SetLinkHeader(int(totalNumOfBranches), listOptions.PageSize) - ctx.RespHeader().Set("X-Total-Count", fmt.Sprintf("%d", totalNumOfBranches)) - ctx.RespHeader().Set("Access-Control-Expose-Headers", "X-Total-Count, Link") - ctx.JSON(http.StatusOK, &BranchesSlice) } + + sort.Sort(git.SortBranch(apiBranches)) + BranchesSlice := BranchesSliceByProtection(ctx, apiBranches) + + ctx.SetLinkHeader(int(totalNumOfBranches), listOptions.PageSize) + ctx.RespHeader().Set("X-Total-Count", fmt.Sprintf("%d", totalNumOfBranches)) + ctx.RespHeader().Set("Access-Control-Expose-Headers", "X-Total-Count, Link") + ctx.JSON(http.StatusOK, &BranchesSlice) } func paginate(branchSlice []*git.Branch, skip, pageSize int) []*git.Branch {