@@ -175,6 +175,52 @@ void test_merge_files__automerge_from_index(void)
175
175
git_merge_file_result_free (& result );
176
176
}
177
177
178
+ void test_merge_files__automerge_from_index_delete_file (void )
179
+ {
180
+ git_merge_file_result result = {0 };
181
+ git_index_entry ancestor , theirs , * ours = NULL ;
182
+
183
+ git_oid_from_string (& ancestor .id , "d427e0b2e138501a3d15cc376077a3631e15bd46" , GIT_OID_SHA1 );
184
+ ancestor .path = "automergeable.txt" ;
185
+ ancestor .mode = GIT_FILEMODE_BLOB ;
186
+
187
+ git_oid_from_string (& theirs .id , "d427e0b2e138501a3d15cc376077a3631e15bd46" , GIT_OID_SHA1 );
188
+ theirs .path = "automergeable.txt" ;
189
+ theirs .mode = GIT_FILEMODE_BLOB ;
190
+
191
+ cl_git_pass (git_merge_file_from_index (& result , repo ,
192
+ & ancestor , ours , & theirs , 0 ));
193
+
194
+ cl_assert_equal_i (1 , result .automergeable );
195
+
196
+ cl_assert_equal_s (NULL , result .path );
197
+ cl_assert_equal_i (GIT_FILEMODE_UNREADABLE , result .mode );
198
+
199
+ cl_assert_equal_i (0 , result .len );
200
+
201
+ git_merge_file_result_free (& result );
202
+ }
203
+
204
+ void test_merge_files__automerge_from_index_add_file (void )
205
+ {
206
+ git_merge_file_result result = {0 };
207
+ git_index_entry * ancestor = NULL , ours , * theirs = NULL ;
208
+
209
+ git_oid_from_string (& ours .id , "d427e0b2e138501a3d15cc376077a3631e15bd46" , GIT_OID_SHA1 );
210
+ ours .path = "automergeable.txt" ;
211
+ ours .mode = GIT_FILEMODE_BLOB ;
212
+
213
+ cl_git_pass (git_merge_file_from_index (& result , repo ,
214
+ ancestor , & ours , theirs , 0 ));
215
+
216
+ cl_assert_equal_i (1 , result .automergeable );
217
+
218
+ cl_assert_equal_s ("automergeable.txt" , result .path );
219
+ cl_assert_equal_i (GIT_FILEMODE_BLOB , result .mode );
220
+
221
+ git_merge_file_result_free (& result );
222
+ }
223
+
178
224
void test_merge_files__automerge_whitespace_eol (void )
179
225
{
180
226
git_merge_file_input ancestor = GIT_MERGE_FILE_INPUT_INIT ,
0 commit comments