예제 #1
0
파일: checkout.go 프로젝트: bradhe/git2go
// Updates files in the working tree to match the content of the index.
func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOpts) error {
	var copts C.git_checkout_opts
	populateCheckoutOpts(&copts, opts)

	ret := C.git_checkout_index(v.ptr, index.ptr, &copts)
	if ret < 0 {
		return LastError()
	}

	return nil
}
예제 #2
0
// Updates files in the working tree to match the content of the given
// index. If index is nil, the repository's index will be used. opts
// may be nil.
func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOpts) error {
	var iptr *C.git_index = nil
	if index != nil {
		iptr = index.ptr
	}

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_checkout_index(v.ptr, iptr, opts.toC())
	if ret < 0 {
		return MakeGitError(ret)
	}

	return nil
}
예제 #3
0
파일: checkout.go 프로젝트: jingweno/git2go
// Updates files in the working tree to match the content of the given
// index. If index is nil, the repository's index will be used. opts
// may be nil.
func (v *Repository) CheckoutIndex(index *Index, opts *CheckoutOpts) error {
	var copts C.git_checkout_options
	ptr := populateCheckoutOpts(&copts, opts)

	var iptr *C.git_index = nil
	if index != nil {
		iptr = index.ptr
	}

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

	ret := C.git_checkout_index(v.ptr, iptr, ptr)
	if ret < 0 {
		return MakeGitError(ret)
	}

	return nil
}