1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-07 19:17:21 +00:00

Display the author and time of git notes

This commit is contained in:
Vladimir Panteleev
2019-05-20 14:31:27 +00:00
parent 89dc23f359
commit 7542929a31
3 changed files with 36 additions and 2 deletions

View File

@ -6,11 +6,14 @@ package git
import (
"io/ioutil"
"gopkg.in/src-d/go-git.v4/plumbing"
)
// Note stores information about a note created using git-notes.
type Note struct {
Message []byte
Commit *Commit
}
// GetNote retrieves the git-notes data for a given commit.
@ -36,7 +39,18 @@ func GetNote(repo *Repository, commitID string, note *Note) error {
if err != nil {
return err
}
note.Message = d
commit, err := repo.gogitRepo.CommitObject(plumbing.Hash(notes.ID))
if err != nil {
return err
}
lastCommits, err := getLastCommitForPaths(commit, "", []string{commitID})
if err != nil {
return err
}
note.Commit = convertCommit(lastCommits[commitID])
return nil
}