summaryrefslogtreecommitdiff
path: root/commit.go
diff options
context:
space:
mode:
authorVicent Marti <[email protected]>2013-04-18 00:54:46 +0200
committerVicent Marti <[email protected]>2013-04-18 00:54:46 +0200
commit2bf17ba2f18ad3ae3068568e5754046544b159b7 (patch)
treeb1cf90f9969d54ea41e06d9930e23004c92c9f99 /commit.go
parent7292cafac2d2c4462f3bc0b850e702d6d87f629e (diff)
Ok, now with shared base object
Diffstat (limited to 'commit.go')
-rw-r--r--commit.go26
1 files changed, 6 insertions, 20 deletions
diff --git a/commit.go b/commit.go
index b1ca6c4..9730a70 100644
--- a/commit.go
+++ b/commit.go
@@ -9,34 +9,20 @@ extern int _go_git_treewalk(git_tree *tree, git_treewalk_mode mode, void *ptr);
import "C"
import (
- "runtime"
"unsafe"
"time"
)
// Commit
type Commit struct {
- ptr *C.git_commit
+ gitObject
}
-func (o *Commit) Id() *Oid {
- return newOidFromC(C.git_commit_id(o.ptr))
-}
-
-func (o *Commit) Type() ObjectType {
- return OBJ_COMMIT
-}
-
-func (o *Commit) Free() {
- runtime.SetFinalizer(o, nil)
- C.git_commit_free(o.ptr)
-}
-
-func (c *Commit) Message() string {
+func (c Commit) Message() string {
return C.GoString(C.git_commit_message(c.ptr))
}
-func (c *Commit) Tree() (*Tree, error) {
+func (c Commit) Tree() (*Tree, error) {
var ptr *C.git_object
err := C.git_commit_tree(&ptr, c.ptr)
@@ -47,16 +33,16 @@ func (c *Commit) Tree() (*Tree, error) {
return allocObject(ptr).(*Tree), nil
}
-func (c *Commit) TreeId() *Oid {
+func (c Commit) TreeId() *Oid {
return newOidFromC(C.git_commit_tree_id(c.ptr))
}
-func (c *Commit) Author() *Signature {
+func (c Commit) Author() *Signature {
ptr := C.git_commit_author(c.ptr)
return newSignatureFromC(ptr)
}
-func (c *Commit) Committer() *Signature {
+func (c Commit) Committer() *Signature {
ptr := C.git_commit_committer(c.ptr)
return newSignatureFromC(ptr)
}