Esempio n. 1
0
func (v *Reference) GetOid() (*Oid, error) {
	oid := C.git_reference_oid(v.git_reference)
	if oid == nil {
		return nil, errors.New("GetOid Failed: unable to get Oid for reference")
	}
	return &Oid{oid}, nil
}
Esempio n. 2
0
func (ref *Reference) Oid() *Oid {
	oid := new(Oid)
	oid.git_oid = C.git_reference_oid(ref.git_reference)
	if oid.git_oid == nil {
		return nil
	}
	return oid
}
Esempio n. 3
0
func (r Reference) Oid() *Oid {
	o := NewOid()
	o.oid = C.git_reference_oid(r.ref)
	//fmt.Println(o.oid, o)
	//if C.int(o.oid) == 0 {
	//		return nil
	//	}
	return o
}
Esempio n. 4
0
File: git.go Progetto: 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
}