Method: Rugged::Index#conflict_get

Defined in:
ext/rugged/rugged_index.c

#conflict_get(path) ⇒ nil

Return index entries from the ancestor, our side and their side of the conflict at path.

If :ancestor, :ours or :theirs is nil, that indicates that path did not exist in the respective tree.

Returns nil if no conflict is present at path.

Returns:

  • (nil)
[View source]

817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
# File 'ext/rugged/rugged_index.c', line 817

static VALUE rb_git_conflict_get(VALUE self, VALUE rb_path)
{
  VALUE rb_result = rb_hash_new();
  git_index *index;
  const git_index_entry *ancestor, *ours, *theirs;
  int error;

  Check_Type(rb_path, T_STRING);

  Data_Get_Struct(self, git_index, index);

  error = git_index_conflict_get(&ancestor, &ours, &theirs, index, StringValueCStr(rb_path));
  if (error == GIT_ENOTFOUND)
    return Qnil;
  else
    rugged_exception_check(error);

  rb_hash_aset(rb_result, CSTR2SYM("ancestor"), rb_git_indexentry_fromC(ancestor));
  rb_hash_aset(rb_result, CSTR2SYM("ours"),     rb_git_indexentry_fromC(ours));
  rb_hash_aset(rb_result, CSTR2SYM("theirs"),   rb_git_indexentry_fromC(theirs));

  return rb_result;
}