diff options
| author | Vicent Marti <[email protected]> | 2013-04-18 00:54:46 +0200 |
|---|---|---|
| committer | Vicent Marti <[email protected]> | 2013-04-18 00:54:46 +0200 |
| commit | 2bf17ba2f18ad3ae3068568e5754046544b159b7 (patch) | |
| tree | b1cf90f9969d54ea41e06d9930e23004c92c9f99 /commit.go | |
| parent | 7292cafac2d2c4462f3bc0b850e702d6d87f629e (diff) | |
Ok, now with shared base object
Diffstat (limited to 'commit.go')
| -rw-r--r-- | commit.go | 26 |
1 files changed, 6 insertions, 20 deletions
@@ -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) } |
