diff options
| author | Aidan Nulman <[email protected]> | 2014-04-03 16:41:43 -0400 |
|---|---|---|
| committer | Aidan Nulman <[email protected]> | 2014-04-03 16:41:43 -0400 |
| commit | d9f4adff6c548a6cb6f00258c99129c7e41062b3 (patch) | |
| tree | 264a73dcf05f99cec7395b20b3488ea202c3cadf /object.go | |
| parent | b5e60dc106828b308fdb7e69fe10a0d2dec4eece (diff) | |
| parent | 9cd1d129bcd567ef65137783a603f8d898d8d933 (diff) | |
Merge branch 'master' into custom_odb
Conflicts:
odb.go
wrapper.c
Diffstat (limited to 'object.go')
| -rw-r--r-- | object.go | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -48,7 +48,7 @@ func (t ObjectType) String() (string) { } func (o gitObject) Id() *Oid { - return newOidFromC(C.git_commit_id(o.ptr)) + return newOidFromC(C.git_object_id(o.ptr)) } func (o gitObject) Type() ObjectType { @@ -57,24 +57,33 @@ func (o gitObject) Type() ObjectType { func (o *gitObject) Free() { runtime.SetFinalizer(o, nil) - C.git_commit_free(o.ptr) + C.git_object_free(o.ptr) } func allocObject(cobj *C.git_object) Object { switch ObjectType(C.git_object_type(cobj)) { case ObjectCommit: - commit := &Commit{gitObject{cobj}} + commit := &Commit{ + gitObject: gitObject{cobj}, + cast_ptr: (*C.git_commit)(cobj), + } runtime.SetFinalizer(commit, (*Commit).Free) return commit case ObjectTree: - tree := &Tree{gitObject{cobj}} + tree := &Tree{ + gitObject: gitObject{cobj}, + cast_ptr: (*C.git_tree)(cobj), + } runtime.SetFinalizer(tree, (*Tree).Free) return tree case ObjectBlob: - blob := &Blob{gitObject{cobj}} + blob := &Blob{ + gitObject: gitObject{cobj}, + cast_ptr: (*C.git_blob)(cobj), + } runtime.SetFinalizer(blob, (*Blob).Free) return blob } |
