summaryrefslogtreecommitdiff
path: root/commit.go
diff options
context:
space:
mode:
authorKatolaZ <[email protected]>2017-07-06 08:40:58 +0100
committerKatolaZ <[email protected]>2017-07-06 08:40:58 +0100
commitf7e15669c89e1af164b673c6fc51e2fb8e82c6a8 (patch)
tree4f6ae3e356486ff09859a2b2bc7d36960f546515 /commit.go
parentc71c935ad1f00e4bdfb4f3968813281f20f07bab (diff)
Added Commit.ExtractSignature to wrap git_commit_extract_signature
Diffstat (limited to 'commit.go')
-rw-r--r--commit.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/commit.go b/commit.go
index 07b7c37..fc2815a 100644
--- a/commit.go
+++ b/commit.go
@@ -26,6 +26,27 @@ func (c Commit) RawMessage() string {
return C.GoString(C.git_commit_message_raw(c.cast_ptr))
}
+func (c Commit) ExtractSignature() (string, string, error) {
+
+ var c_signed C.git_buf
+ defer C.git_buf_free(&c_signed)
+
+ var c_signature C.git_buf
+ defer C.git_buf_free(&c_signature)
+
+ oid := c.Id()
+
+ repo := C.git_commit_owner(c.cast_ptr)
+ ret := C.git_commit_extract_signature(&c_signature, &c_signed, repo, oid.toC(), nil)
+
+ if ret < 0 {
+ return "", "", MakeGitError(ret)
+ } else {
+ return C.GoString(c_signature.ptr), C.GoString(c_signed.ptr), nil
+ }
+
+}
+
func (c Commit) Summary() string {
return C.GoString(C.git_commit_summary(c.cast_ptr))
}