Merge pull request '增加commit详情页分支信息' (#44) from develop into master

This commit is contained in:
yystopf 2021-12-29 10:11:31 +08:00
commit 72ac212a9f
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{
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,
Parents: apiParents,
Files: affectedFileList,
Branch: commit.Branch,
}, nil
}

View File

@ -49,6 +49,7 @@ type Commit struct {
Parents []*CommitMeta `json:"parents"`
Files []*CommitAffectedFiles `json:"files"`
CommitDate string `json:"commit_date"`
Branch string `json:"branch"`
}
// 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"))
issue := pr.Issue
// issue := checkPullInfo(ctx.Context)
log.Info("issue %s", issue)
if issue == nil {
ctx.NotFound("checkPullInfo", nil)

View File

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