Method: Rugged::Repository#checkout_head

Defined in:
ext/rugged/rugged_repo.c

#checkout_head([options]) ⇒ nil

Updates files in the index and the working tree to match the content of the commit pointed at by HEAD.

See Repository#checkout_tree for a list of supported options.

Returns:

  • (nil)
[View source]

2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
# File 'ext/rugged/rugged_repo.c', line 2457

static VALUE rb_git_checkout_head(int argc, VALUE *argv, VALUE self)
{
	VALUE rb_options;
	git_repository *repo;
	git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
	struct rugged_cb_payload *payload;
	int error, exception = 0;

	rb_scan_args(argc, argv, "00:", &rb_options);

	Data_Get_Struct(self, git_repository, repo);

	rugged_parse_checkout_options(&opts, rb_options);

	error = git_checkout_head(repo, &opts);
	xfree(opts.paths.strings);

	if ((payload = opts.notify_payload) != NULL) {
		exception = payload->exception;
		xfree(opts.notify_payload);
	}

	if ((payload = opts.progress_payload) != NULL) {
		exception = payload->exception;
		xfree(opts.progress_payload);
	}

	if (exception)
		rb_jump_tag(exception);

	rugged_exception_check(error);

	return Qnil;
}