예제 #1
0
// Next retrieves the next reference. If the iterationis over, the
// returned error is git.ErrIterOver
func (v *ReferenceIterator) Next() (*Reference, error) {
	var ptr *C.git_reference
	ret := C.git_reference_next(&ptr, v.ptr)
	if ret < 0 {
		return nil, MakeGitError(ret)
	}

	return newReferenceFromC(ptr, v.repo), nil
}
예제 #2
0
파일: reference.go 프로젝트: pjvds/git2go
// Next retrieves the next reference name. If the iteration is over,
// the returned error is git.ErrIterOver
func (v *ReferenceIterator) Next() (string, error) {
	var ptr *C.char
	ret := C.git_reference_next(&ptr, v.ptr)
	if ret == ITEROVER {
		return "", ErrIterOver
	}
	if ret < 0 {
		return "", LastError()
	}

	return C.GoString(ptr), nil
}
예제 #3
0
// Next retrieves the next reference. If the iterationis over, the
// returned error is git.ErrIterOver
func (v *ReferenceIterator) Next() (*Reference, error) {
	var ptr *C.git_reference
	ret := C.git_reference_next(&ptr, v.ptr)
	if ret == ITEROVER {
		return nil, ErrIterOver
	}
	if ret < 0 {
		return nil, LastError()
	}

	return newReferenceFromC(ptr), nil
}