Tag any kind of object #397
4
blob.go
4
blob.go
|
@ -20,6 +20,10 @@ type Blob struct {
|
|||
cast_ptr *C.git_blob
|
||||
}
|
||||
|
||||
func (b *Blob) AsObject() *Object {
|
||||
return &b.Object
|
||||
}
|
||||
|
||||
func (v *Blob) Size() int64 {
|
||||
ret := int64(C.git_blob_rawsize(v.cast_ptr))
|
||||
runtime.KeepAlive(v)
|
||||
|
|
|
@ -18,6 +18,10 @@ type Commit struct {
|
|||
cast_ptr *C.git_commit
|
||||
}
|
||||
|
||||
func (c *Commit) AsObject() *Object {
|
||||
return &c.Object
|
||||
}
|
||||
|
||||
func (c *Commit) Message() string {
|
||||
ret := C.GoString(C.git_commit_message(c.cast_ptr))
|
||||
runtime.KeepAlive(c)
|
||||
|
|
|
@ -26,6 +26,11 @@ type Object struct {
|
|||
repo *Repository
|
||||
}
|
||||
|
||||
// Objecter lets us accept any kind of Git object in functions.
|
||||
type Objecter interface {
|
||||
AsObject() *Object
|
||||
}
|
||||
|
||||
func (t ObjectType) String() string {
|
||||
switch t {
|
||||
case ObjectAny:
|
||||
|
|
4
tag.go
4
tag.go
|
@ -17,6 +17,10 @@ type Tag struct {
|
|||
cast_ptr *C.git_tag
|
||||
}
|
||||
|
||||
func (t *Tag) AsObject() *Object {
|
||||
return &t.Object
|
||||
}
|
||||
|
||||
func (t Tag) Message() string {
|
||||
ret := C.GoString(C.git_tag_message(t.cast_ptr))
|
||||
runtime.KeepAlive(t)
|
||||
|
|
Loading…
Reference in New Issue