// Head returns the commit at the head of the repository. func (r *Repository) Head() (*Commit, error) { var reference *C.struct_git_reference if C.git_repository_head(&reference, r.repository) != C.GIT_OK { return nil, lastErr() } defer C.git_reference_free(reference) c := new(Commit) if C.git_commit_lookup(&c.commit, r.repository, C.git_reference_oid(reference)) != C.GIT_OK { return nil, lastErr() } return c, nil }
func (v *Reference) Free() { runtime.SetFinalizer(v, nil) C.git_reference_free(v.ptr) }
func (ref *Reference) Free() { C.git_reference_free(ref.git_reference) }