forked from NYANDEV/forgejo
Display commit status on landing page of repo (#1784)
* Display commit status on landing page of repo * improve last status of commits and add link to ci * fix last commit status since the order of ids are desc
This commit is contained in:
parent
a89692d158
commit
be3319b3d5
7 changed files with 60 additions and 28 deletions
|
@ -13,7 +13,9 @@ import (
|
|||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
"github.com/Unknwon/paginater"
|
||||
)
|
||||
|
||||
|
@ -208,6 +210,14 @@ func Diff(ctx *context.Context) {
|
|||
if len(commitID) != 40 {
|
||||
commitID = commit.ID.String()
|
||||
}
|
||||
|
||||
statuses, err := models.GetLatestCommitStatus(ctx.Repo.Repository, ctx.Repo.Commit.ID.String(), 0)
|
||||
if err != nil {
|
||||
log.Error(3, "GetLatestCommitStatus: %v", err)
|
||||
}
|
||||
|
||||
ctx.Data["CommitStatus"] = models.CalcCommitStatus(statuses)
|
||||
|
||||
diff, err := models.GetDiffCommit(models.RepoPath(userName, repoName),
|
||||
commitID, setting.Git.MaxGitDiffLines,
|
||||
setting.Git.MaxGitDiffLineCharacters, setting.Git.MaxGitDiffFiles)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue