Method: Rugged::Index#remove_all
- Defined in:
- ext/rugged/rugged_index.c
permalink #remove_all(pathspec = []) ⇒ nil #remove_all(pathspec = []) {|path, pathspec| ... } ⇒ nil
Remove all matching index entries.
Searches index
for entries that match pathspec
and removes them from the index.
pathspec
can either be a String, or an Array of Strings. If pathspec
is empty, all entries in the index will be matched.
If a block is given, each matched path
and the pathspec
that matched it will be passed to the block. If the return value of block
is falsy, the matching item will not be removed from the index.
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 |
# File 'ext/rugged/rugged_index.c', line 477
static VALUE rb_git_index_remove_all(int argc, VALUE *argv, VALUE self)
{
VALUE rb_pathspecs = rb_ary_new();
git_index *index;
git_strarray pathspecs;
int error, exception = 0;
Data_Get_Struct(self, git_index, index);
rb_scan_args(argc, argv, "01", &rb_pathspecs);
if (NIL_P(rb_pathspecs))
rb_pathspecs = rb_ary_new();
rugged_rb_ary_to_strarray(rb_ary_to_ary(rb_pathspecs), &pathspecs);
error = git_index_remove_all(index, &pathspecs,
rb_block_given_p() ? rugged__index_matched_path_cb : NULL, &exception);
xfree(pathspecs.strings);
if (exception)
rb_jump_tag(exception);
rugged_exception_check(error);
return Qnil;
}
|