Method: Rugged::Index#conflicts
- Defined in:
- ext/rugged/rugged_index.c
permalink #conflicts ⇒ Object
Return all conflicts in index
.
Each conflict is represented as a Hash with :ancestor
, :ours
or :theirs
key-value pairs, each containing index entry data.
If the value of the :ancestor
, :ours
or :theirs
key is nil
, that indicates that file in conflict did not exists in the respective tree.
951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 |
# File 'ext/rugged/rugged_index.c', line 951
static VALUE rb_git_index_conflicts(VALUE self)
{
VALUE rb_conflicts = rb_ary_new();
git_index *index;
git_index_conflict_iterator *iter;
const git_index_entry *ancestor, *ours, *theirs;
int error;
Data_Get_Struct(self, git_index, index);
error = git_index_conflict_iterator_new(&iter, index);
rugged_exception_check(error);
while ((error = git_index_conflict_next(&ancestor, &ours, &theirs, iter)) == GIT_OK) {
VALUE rb_conflict = rb_hash_new();
rb_hash_aset(rb_conflict, CSTR2SYM("ancestor"), rb_git_indexentry_fromC(ancestor));
rb_hash_aset(rb_conflict, CSTR2SYM("ours"), rb_git_indexentry_fromC(ours));
rb_hash_aset(rb_conflict, CSTR2SYM("theirs"), rb_git_indexentry_fromC(theirs));
rb_ary_push(rb_conflicts, rb_conflict);
}
git_index_conflict_iterator_free(iter);
if (error != GIT_ITEROVER)
rugged_exception_check(error);
return rb_conflicts;
}
|