func (c *ReferenceCollection) EnsureLog(name string) error {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()
	ret := C.git_reference_ensure_log(c.repo.ptr, cname)
	if ret < 0 {
		return MakeGitError(ret)
	}
	return nil
}
EnsureLog ensures that there is a reflog for the given reference
name and creates an empty one if necessary.
package git
import "C"
import (
	"runtime"
	"unsafe"
)
type ReferenceType int
const (
	ReferenceSymbolic ReferenceType = C.GIT_REF_SYMBOLIC
	ReferenceOid      ReferenceType = C.GIT_REF_OID
)
type Reference struct {
	ptr  *C.git_reference
	repo *Repository
}
type ReferenceCollection struct {
	repo *Repository
}
func (c *ReferenceCollection) Lookup(name string) (*Reference, error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	var ptr *C.git_reference
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()
	ecode := C.git_reference_lookup(&ptr, c.repo.ptr, cname)
	if ecode < 0 {
		return nil, MakeGitError(ecode)
	}
	return newReferenceFromC(ptr, c.repo), nil
}
func (c *ReferenceCollection) Create(name string, id *Oid, force bool, msg string) (*Reference, error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	var cmsg *C.char
	if msg == "" {
		cmsg = nil
	} else {
		cmsg = C.CString(msg)
		defer C.free(unsafe.Pointer(cmsg))
	}
	var ptr *C.git_reference
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()
	ecode := C.git_reference_create(&ptr, c.repo.ptr, cname, id.toC(), cbool(force), cmsg)
	if ecode < 0 {
		return nil, MakeGitError(ecode)
	}
	return newReferenceFromC(ptr, c.repo), nil
}
func (c *ReferenceCollection) CreateSymbolic(name, target string, force bool, msg string) (*Reference, error) {
	cname := C.CString(name)
	defer C.free(unsafe.Pointer(cname))
	ctarget := C.CString(target)
	defer C.free(unsafe.Pointer(ctarget))
	var cmsg *C.char
	if msg == "" {
		cmsg = nil
	} else {
		cmsg = C.CString(msg)
		defer C.free(unsafe.Pointer(cmsg))
	}
	var ptr *C.git_reference
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()
	ecode := C.git_reference_symbolic_create(&ptr, c.repo.ptr, cname, ctarget, cbool(force), cmsg)
	if ecode < 0 {
		return nil, MakeGitError(ecode)
	}
	return newReferenceFromC(ptr, c.repo), nil
}