Merge pull request #474 from libgit2/cmn/deprecated-names
Use git_object_t instead of deprecated git_otype
This commit is contained in:
commit
fb438dbf9a
14
object.go
14
object.go
|
@ -13,12 +13,12 @@ import (
|
|||
type ObjectType int
|
||||
|
||||
const (
|
||||
ObjectAny ObjectType = C.GIT_OBJ_ANY
|
||||
ObjectBad ObjectType = C.GIT_OBJ_BAD
|
||||
ObjectCommit ObjectType = C.GIT_OBJ_COMMIT
|
||||
ObjectTree ObjectType = C.GIT_OBJ_TREE
|
||||
ObjectBlob ObjectType = C.GIT_OBJ_BLOB
|
||||
ObjectTag ObjectType = C.GIT_OBJ_TAG
|
||||
ObjectAny ObjectType = C.GIT_OBJECT_ANY
|
||||
ObjectBad ObjectType = C.GIT_OBJECT_BAD
|
||||
ObjectCommit ObjectType = C.GIT_OBJECT_COMMIT
|
||||
ObjectTree ObjectType = C.GIT_OBJECT_TREE
|
||||
ObjectBlob ObjectType = C.GIT_OBJECT_BLOB
|
||||
ObjectTag ObjectType = C.GIT_OBJECT_TAG
|
||||
)
|
||||
|
||||
type Object struct {
|
||||
|
@ -217,7 +217,7 @@ func (o *Object) Peel(t ObjectType) (*Object, error) {
|
|||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
err := C.git_object_peel(&cobj, o.ptr, C.git_otype(t))
|
||||
err := C.git_object_peel(&cobj, o.ptr, C.git_object_t(t))
|
||||
runtime.KeepAlive(o)
|
||||
if err < 0 {
|
||||
return nil, MakeGitError(err)
|
||||
|
|
12
odb.go
12
odb.go
|
@ -61,12 +61,12 @@ func (v *Odb) ReadHeader(oid *Oid) (uint64, ObjectType, error) {
|
|||
defer runtime.UnlockOSThread()
|
||||
|
||||
var sz C.size_t
|
||||
var cotype C.git_otype
|
||||
var cotype C.git_object_t
|
||||
|
||||
ret := C.git_odb_read_header(&sz, &cotype, v.ptr, oid.toC())
|
||||
runtime.KeepAlive(v)
|
||||
if ret < 0 {
|
||||
return 0, C.GIT_OBJ_BAD, MakeGitError(ret)
|
||||
return 0, ObjectBad, MakeGitError(ret)
|
||||
}
|
||||
|
||||
return uint64(sz), ObjectType(cotype), nil
|
||||
|
@ -93,7 +93,7 @@ func (v *Odb) Write(data []byte, otype ObjectType) (oid *Oid, err error) {
|
|||
size = C.size_t(0)
|
||||
}
|
||||
|
||||
ret := C.git_odb_write(oid.toC(), v.ptr, unsafe.Pointer(&data[0]), size, C.git_otype(otype))
|
||||
ret := C.git_odb_write(oid.toC(), v.ptr, unsafe.Pointer(&data[0]), size, C.git_object_t(otype))
|
||||
runtime.KeepAlive(v)
|
||||
if ret < 0 {
|
||||
return nil, MakeGitError(ret)
|
||||
|
@ -181,7 +181,7 @@ func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error) {
|
|||
size = C.size_t(0)
|
||||
}
|
||||
|
||||
ret := C.git_odb_hash(oid.toC(), unsafe.Pointer(&data[0]), size, C.git_otype(otype))
|
||||
ret := C.git_odb_hash(oid.toC(), unsafe.Pointer(&data[0]), size, C.git_object_t(otype))
|
||||
runtime.KeepAlive(data)
|
||||
if ret < 0 {
|
||||
return nil, MakeGitError(ret)
|
||||
|
@ -193,7 +193,7 @@ func (v *Odb) Hash(data []byte, otype ObjectType) (oid *Oid, err error) {
|
|||
// contents of the object.
|
||||
func (v *Odb) NewReadStream(id *Oid) (*OdbReadStream, error) {
|
||||
stream := new(OdbReadStream)
|
||||
var ctype C.git_otype
|
||||
var ctype C.git_object_t
|
||||
var csize C.size_t
|
||||
|
||||
runtime.LockOSThread()
|
||||
|
@ -221,7 +221,7 @@ func (v *Odb) NewWriteStream(size int64, otype ObjectType) (*OdbWriteStream, err
|
|||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
ret := C.git_odb_open_wstream(&stream.ptr, v.ptr, C.git_off_t(size), C.git_otype(otype))
|
||||
ret := C.git_odb_open_wstream(&stream.ptr, v.ptr, C.git_off_t(size), C.git_object_t(otype))
|
||||
runtime.KeepAlive(v)
|
||||
if ret < 0 {
|
||||
return nil, MakeGitError(ret)
|
||||
|
|
|
@ -284,7 +284,7 @@ func (v *Reference) Peel(t ObjectType) (*Object, error) {
|
|||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
err := C.git_reference_peel(&cobj, v.ptr, C.git_otype(t))
|
||||
err := C.git_reference_peel(&cobj, v.ptr, C.git_object_t(t))
|
||||
runtime.KeepAlive(v)
|
||||
if err < 0 {
|
||||
return nil, MakeGitError(err)
|
||||
|
|
|
@ -174,7 +174,7 @@ func (v *Repository) lookupType(id *Oid, t ObjectType) (*Object, error) {
|
|||
runtime.LockOSThread()
|
||||
defer runtime.UnlockOSThread()
|
||||
|
||||
ret := C.git_object_lookup(&ptr, v.ptr, id.toC(), C.git_otype(t))
|
||||
ret := C.git_object_lookup(&ptr, v.ptr, id.toC(), C.git_object_t(t))
|
||||
runtime.KeepAlive(id)
|
||||
if ret < 0 {
|
||||
return nil, MakeGitError(ret)
|
||||
|
|
Loading…
Reference in New Issue