Method: Rugged::Index#read_tree

Defined in:
ext/rugged/rugged_index.c

#read_tree(tree) ⇒ Object

Clear the current index and start the index again on top of tree

Further index operations (add, update, remove, etc) will be considered changes on top of tree.

[View source]

656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
# File 'ext/rugged/rugged_index.c', line 656

static VALUE rb_git_index_readtree(VALUE self, VALUE rb_tree)
{
	git_index *index;
	git_tree *tree;
	int error;

	Data_Get_Struct(self, git_index, index);
	TypedData_Get_Struct(rb_tree, git_tree, &rugged_object_type, tree);

	if (!rb_obj_is_kind_of(rb_tree, rb_cRuggedTree)) {
		rb_raise(rb_eTypeError, "A Rugged::Tree instance is required");
	}

	error = git_index_read_tree(index, tree);
	rugged_exception_check(error);

	return Qnil;
}