Merge pull request '修改branch_tag_count接口' (#33) from wonderful/gitea-1120-rc1:fix_pulls into develop

This commit is contained in:
jasder 2021-10-26 11:53:09 +08:00
commit c9c2aac882
2 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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)
}