Method: Rugged::Index#update_all

Defined in:
ext/rugged/rugged_index.c

#update_all(pathspec = []) ⇒ nil #update_all(pathspec = []) {|path, pathspec| ... } ⇒ nil

Update all index entries to match the working directory.

Searches index for entries that match pathspec and synchronizes them with the content of the working directory.

pathspec can either be a String, or an Array of Strings. If pathspec is empty, all entries in the index will be matched.

Entries where the corresponding working directory file no longer exists get deleted, all other matched entries will get updated to reflect their working directory state (the latest version of the a file’s content will automatically be added to the ODB).

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 updated in the index.

This method will fail in bare index instances.

Overloads:

  • #update_all(pathspec = []) ⇒ nil

    Returns:

    • (nil)
  • #update_all(pathspec = []) {|path, pathspec| ... } ⇒ nil

    Yields:

    • (path, pathspec)

    Returns:

    • (nil)
[View source]

434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'ext/rugged/rugged_index.c', line 434

static VALUE rb_git_index_update_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);

	rugged_rb_ary_to_strarray(rb_pathspecs, &pathspecs);

	error = git_index_update_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;
}