修复: blame 响应结构体

This commit is contained in:
yystopf 2022-07-06 14:49:31 +08:00
parent a3b1439a52
commit 4a21b9f7ac
1 changed files with 12 additions and 3 deletions

View File

@ -9,6 +9,13 @@ import (
"code.gitea.io/gitea/modules/git"
)
type APIBlameResponse struct {
FileSize int64 `json:"file_size"`
FileName string `json:"file_name"`
NumberLines int `json:"num_lines"`
BlameParts []git.ApiBlamePart `json:"blame_parts"`
}
func GetRepoRefBlame(ctx *context.APIContext) {
// swagger:operation GET /repos/{owner}/{repo}/blame repository repoGetRefBlame
// ---
@ -99,8 +106,10 @@ func GetRepoRefBlame(ctx *context.APIContext) {
currentNumber += blamePart.EffectLine
}
ctx.JSON(http.StatusOK, map[string]interface{}{
"num_lines": numLines,
"blame_parts": blameParts,
ctx.JSON(http.StatusOK, APIBlameResponse{
FileSize: blob.Size(),
FileName: blob.Name(),
NumberLines: numLines,
BlameParts: blameParts,
})
}