aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/commit.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2019-04-25 01:09:41 +0200
committerGitHub <noreply@github.com>2019-04-25 01:09:41 +0200
commit830ee5b7d6e7674d41d1fc5b47c2cd6e76a07f5b (patch)
tree5ecc242d91281bbccb80434507ada6a5ba8e74e6 /plumbing/object/commit.go
parent5c6d199dc675465f5e103ea36c0bfcb9d3ebc565 (diff)
parenta04488c786baffa1faea9f501349fa63c28931a1 (diff)
downloadgo-git-830ee5b7d6e7674d41d1fc5b47c2cd6e76a07f5b.tar.gz
Merge pull request #1127 from sapk-fork/imp-1116
plumbing: object/{commit,tag} add EncodeWithoutSignature, Implement #1116
Diffstat (limited to 'plumbing/object/commit.go')
-rw-r--r--plumbing/object/commit.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/plumbing/object/commit.go b/plumbing/object/commit.go
index 511242d..6b50934 100644
--- a/plumbing/object/commit.go
+++ b/plumbing/object/commit.go
@@ -235,6 +235,11 @@ func (b *Commit) Encode(o plumbing.EncodedObject) error {
return b.encode(o, true)
}
+// EncodeWithoutSignature export a Commit into a plumbing.EncodedObject without the signature (correspond to the payload of the PGP signature).
+func (b *Commit) EncodeWithoutSignature(o plumbing.EncodedObject) error {
+ return b.encode(o, false)
+}
+
func (b *Commit) encode(o plumbing.EncodedObject, includeSig bool) (err error) {
o.SetType(plumbing.CommitObject)
w, err := o.Writer()
@@ -349,7 +354,7 @@ func (c *Commit) Verify(armoredKeyRing string) (*openpgp.Entity, error) {
encoded := &plumbing.MemoryObject{}
// Encode commit components, excluding signature and get a reader object.
- if err := c.encode(encoded, false); err != nil {
+ if err := c.EncodeWithoutSignature(encoded); err != nil {
return nil, err
}
er, err := encoded.Reader()