mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-19 15:14:09 +09:00
Show git-notes
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
package repo
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
@ -15,6 +16,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/templates"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -246,6 +248,23 @@ func Diff(ctx *context.Context) {
|
||||
ctx.Data["Parents"] = parents
|
||||
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
|
||||
ctx.Data["SourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", commitID)
|
||||
|
||||
notes, err := ctx.Repo.GitRepo.GetCommit("refs/notes/commits")
|
||||
if err == nil {
|
||||
entry, err := notes.GetTreeEntryByPath(commitID)
|
||||
if err == nil {
|
||||
blob := entry.Blob()
|
||||
dataRc, err := blob.DataAsync()
|
||||
if err == nil {
|
||||
d, err := ioutil.ReadAll(dataRc)
|
||||
dataRc.Close()
|
||||
if err == nil {
|
||||
ctx.Data["Note"] = string(templates.ToUTF8WithFallback(d))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if commit.ParentCount() > 0 {
|
||||
ctx.Data["BeforeSourcePath"] = setting.AppSubURL + "/" + path.Join(userName, repoName, "src", "commit", parents[0])
|
||||
}
|
||||
|
Reference in New Issue
Block a user