Merge pull request '给提交页面添加 branch' (#43) from wonderful/gitea-1156:develop into develop

This commit is contained in:
yystopf 2021-12-29 10:09:03 +08:00
commit b1ab0f7f5f
4 changed files with 7 additions and 2 deletions

View File

@ -144,6 +144,7 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string]
}) })
} }
} }
commit.LoadBranchName()
return &api.Commit{ return &api.Commit{
CommitDate: commit.Committer.When.Format("2006-01-02"), // new time format, year-moon-day CommitDate: commit.Committer.When.Format("2006-01-02"), // new time format, year-moon-day
@ -178,5 +179,6 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string]
Committer: apiCommitter, Committer: apiCommitter,
Parents: apiParents, Parents: apiParents,
Files: affectedFileList, Files: affectedFileList,
Branch: commit.Branch,
}, nil }, nil
} }

View File

@ -49,6 +49,7 @@ type Commit struct {
Parents []*CommitMeta `json:"parents"` Parents []*CommitMeta `json:"parents"`
Files []*CommitAffectedFiles `json:"files"` Files []*CommitAffectedFiles `json:"files"`
CommitDate string `json:"commit_date"` CommitDate string `json:"commit_date"`
Branch string `json:"branch"`
} }
// CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE // CommitDateOptions store dates for GIT_AUTHOR_DATE and GIT_COMMITTER_DATE

View File

@ -1387,8 +1387,6 @@ func GetPullFiles(ctx *context.APIContext) {
pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
issue := pr.Issue issue := pr.Issue
// issue := checkPullInfo(ctx.Context)
log.Info("issue %s", issue)
if issue == nil { if issue == nil {
ctx.NotFound("checkPullInfo", nil) ctx.NotFound("checkPullInfo", nil)

View File

@ -13268,6 +13268,10 @@
"author": { "author": {
"$ref": "#/definitions/User" "$ref": "#/definitions/User"
}, },
"branch": {
"type": "string",
"x-go-name": "Branch"
},
"commit": { "commit": {
"$ref": "#/definitions/RepoCommit" "$ref": "#/definitions/RepoCommit"
}, },