aboutsummaryrefslogtreecommitdiffstats
path: root/repository/gogit.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2021-02-09 10:46:33 +0100
committerMichael Muré <batolettre@gmail.com>2021-02-14 12:19:02 +0100
commit2bdb1b60ff83de157f1a0d9ed42555d96b945fa6 (patch)
treefe51b44176ac1c6d279f651efd7cc19bc8cae88a /repository/gogit.go
parent26a4b0332e0f0a52026ac6e333e0bbd78a588171 (diff)
downloadgit-bug-2bdb1b60ff83de157f1a0d9ed42555d96b945fa6.tar.gz
entity: working commit signatures
Diffstat (limited to 'repository/gogit.go')
-rw-r--r--repository/gogit.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/repository/gogit.go b/repository/gogit.go
index c26fde9f..73672933 100644
--- a/repository/gogit.go
+++ b/repository/gogit.go
@@ -715,12 +715,7 @@ func (repo *GoGitRepo) ListCommits(ref string) ([]Hash, error) {
}
func (repo *GoGitRepo) ReadCommit(hash Hash) (Commit, error) {
- encoded, err := repo.r.Storer.EncodedObject(plumbing.CommitObject, plumbing.NewHash(hash.String()))
- if err != nil {
- return Commit{}, err
- }
-
- commit, err := object.DecodeCommit(repo.r.Storer, encoded)
+ commit, err := repo.r.CommitObject(plumbing.NewHash(hash.String()))
if err != nil {
return Commit{}, err
}
@@ -737,6 +732,15 @@ func (repo *GoGitRepo) ReadCommit(hash Hash) (Commit, error) {
}
if commit.PGPSignature != "" {
+ // I can't find a way to just remove the signature when reading the encoded commit so we need to
+ // re-encode the commit without signature.
+
+ encoded := &plumbing.MemoryObject{}
+ err := commit.EncodeWithoutSignature(encoded)
+ if err != nil {
+ return Commit{}, err
+ }
+
result.SignedData, err = encoded.Reader()
if err != nil {
return Commit{}, err