Skip to content

Commit c22e05d

Browse files
author
Edward Thomson
committed
Index.merge_file: raise when missing ours or theirs
When a conflict is missing the ours or the theirs side, we cannot produce a merged file.
1 parent 64a2a0c commit c22e05d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ext/rugged/rugged_index.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,11 @@ static VALUE rb_git_merge_file(int argc, VALUE *argv, VALUE self)
10921092
else
10931093
rugged_exception_check(error);
10941094

1095+
if (ours == NULL)
1096+
rb_raise(rb_eRuntimeError, "The conflict does not have a stage 2 entry");
1097+
else if (theirs == NULL)
1098+
rb_raise(rb_eRuntimeError, "The conflict does not have a stage 3 entry");
1099+
10951100
error = git_merge_file_from_index(&merge_file_result, repo, ancestor, ours, theirs, &opts);
10961101
rugged_exception_check(error);
10971102

0 commit comments

Comments
 (0)