Beispiel #1
0
// 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
}
Beispiel #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
}
Beispiel #3
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 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
}