Пример #1
0
// Updates files in the index and the working tree to match the content of
// the commit pointed at by HEAD. opts may be nil.
func (v *Repository) CheckoutHead(opts *CheckoutOpts) error {
	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

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

	return nil
}
Пример #2
0
// Updates files in the index and the working tree to match the content of
// the commit pointed at by HEAD.
func (v *Repository) Checkout(opts *CheckoutOpts) error {
	var copts C.git_checkout_opts
	populateCheckoutOpts(&copts, opts)

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

	return nil
}
Пример #3
0
// Updates files in the index and the working tree to match the content of
// the commit pointed at by HEAD. opts may be nil.
func (v *Repository) CheckoutHead(opts *CheckoutOpts) error {
	var copts C.git_checkout_options

	ptr := populateCheckoutOpts(&copts, opts)

	runtime.LockOSThread()
	defer runtime.UnlockOSThread()

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

	return nil
}