Exemplo n.º 1
0
Arquivo: git.go Projeto: fsouza/gogit
// 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
}
Exemplo n.º 2
0
func (v *Reference) Free() {
	runtime.SetFinalizer(v, nil)
	C.git_reference_free(v.ptr)
}
Exemplo n.º 3
0
func (ref *Reference) Free() {
	C.git_reference_free(ref.git_reference)
}