forked from Gitlink/gitea-1120-rc1
fix:branch_tag_count
This commit is contained in:
parent
52d9414a29
commit
e19cd0998e
|
@ -10,8 +10,8 @@ import (
|
|||
|
||||
//add
|
||||
type RepoBranchAndTagCount struct {
|
||||
BranchCount int `json:"branch_count"`
|
||||
TagCount int64 `json:"tag_count"`
|
||||
BranchCount int `json:"branch_count"`
|
||||
TagCount int `json:"tag_count"`
|
||||
}
|
||||
|
||||
// Permission represents a set of permissions
|
||||
|
@ -236,6 +236,7 @@ type MigrateRepoOption struct {
|
|||
CloneAddr string `json:"clone_addr" binding:"Required"`
|
||||
AuthUsername string `json:"auth_username"`
|
||||
AuthPassword string `json:"auth_password"`
|
||||
AuthToken string `json:"auth_token"`
|
||||
// required: true
|
||||
UID int `json:"uid" binding:"Required"`
|
||||
// required: true
|
||||
|
|
|
@ -146,11 +146,12 @@ func GetRepoBranchAndTagCount(ctx *context.APIContext) {
|
|||
// "200":
|
||||
// "$ref": "#/responses/RepoBranchAndTagCount"
|
||||
|
||||
tagsCountTotal, err := ctx.Repo.GitRepo.GetTagCount()
|
||||
tags, err := ctx.Repo.GitRepo.GetTagInfos(0, 0)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "GetTagCount", err)
|
||||
ctx.Error(http.StatusInternalServerError, "GetTags", err)
|
||||
return
|
||||
}
|
||||
|
||||
repo := ctx.Repo.Repository
|
||||
branches, err := repo_module.GetBranches(repo)
|
||||
if err != nil {
|
||||
|
@ -159,7 +160,7 @@ func GetRepoBranchAndTagCount(ctx *context.APIContext) {
|
|||
}
|
||||
result := api.RepoBranchAndTagCount{
|
||||
BranchCount: len(branches),
|
||||
TagCount: tagsCountTotal,
|
||||
TagCount: len(tags),
|
||||
}
|
||||
ctx.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue