Method: Rugged::Repository#checkout_index
- Defined in:
- ext/rugged/rugged_repo.c
permalink #checkout_index(index[,options]) ⇒ nil
Updates files in the index and the working tree to match the content of the commit pointed at by index
.
See Repository#checkout_tree for a list of supported options
.
2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 |
# File 'ext/rugged/rugged_repo.c', line 2409
static VALUE rb_git_checkout_index(int argc, VALUE *argv, VALUE self)
{
VALUE rb_index, rb_options;
git_repository *repo;
git_index *index;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
struct rugged_cb_payload *payload;
int error, exception = 0;
rb_scan_args(argc, argv, "10:", &rb_index, &rb_options);
if (!rb_obj_is_kind_of(rb_index, rb_cRuggedIndex))
rb_raise(rb_eTypeError, "Expected Rugged::Index");
Data_Get_Struct(self, git_repository, repo);
Data_Get_Struct(rb_index, git_index, index);
rugged_parse_checkout_options(&opts, rb_options);
error = git_checkout_index(repo, index, &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;
}
|