Method: Rugged::Index#conflict_add
- Defined in:
- ext/rugged/rugged_index.c
permalink #conflict_add(conflict) ⇒ nil
Add or update index entries that represent a conflict.
conflict
has to be a hash containing :ancestor
, :ours
and :theirs
key/value pairs. Any of those paris can be nil
(or left out) to indicate that the file was not present in the respective tree during the merge.
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 |
# File 'ext/rugged/rugged_index.c', line 751
static VALUE rb_git_conflict_add(VALUE self, VALUE rb_conflict)
{
VALUE rb_ancestor, rb_ours, rb_theirs;
git_index *index;
git_index_entry ancestor, ours, theirs;
int error;
Check_Type(rb_conflict, T_HASH);
rb_ancestor = rb_hash_aref(rb_conflict, CSTR2SYM("ancestor"));
rb_ours = rb_hash_aref(rb_conflict, CSTR2SYM("ours"));
rb_theirs = rb_hash_aref(rb_conflict, CSTR2SYM("theirs"));
if (!NIL_P(rb_ancestor))
rb_git_indexentry_toC(&ancestor, rb_ancestor);
if (!NIL_P(rb_ours))
rb_git_indexentry_toC(&ours, rb_ours);
if (!NIL_P(rb_theirs))
rb_git_indexentry_toC(&theirs, rb_theirs);
Data_Get_Struct(self, git_index, index);
error = git_index_conflict_add(index,
NIL_P(rb_ancestor) ? NULL : &ancestor,
NIL_P(rb_theirs) ? NULL : &ours,
NIL_P(rb_ours) ? NULL : &theirs);
rugged_exception_check(error);
return Qnil;
}
|