@@ -252,6 +252,63 @@ void test_rebase_merge__commit(void)
252
252
git_rebase_free (rebase );
253
253
}
254
254
255
+ void test_rebase_merge__commit_with_id (void )
256
+ {
257
+ git_rebase * rebase ;
258
+ git_oid branch_id , upstream_id ;
259
+ git_annotated_commit * branch_head , * upstream_head ;
260
+ git_rebase_operation * rebase_operation ;
261
+ git_oid commit_id , tree_id , parent_id ;
262
+ git_signature * author ;
263
+ git_commit * commit ;
264
+ git_reflog * reflog ;
265
+ const git_reflog_entry * reflog_entry ;
266
+
267
+ cl_git_pass (git_oid_fromstr (& branch_id , "b146bd7608eac53d9bf9e1a6963543588b555c64" ));
268
+ cl_git_pass (git_oid_fromstr (& upstream_id , "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00" ));
269
+
270
+ cl_git_pass (git_annotated_commit_lookup (& branch_head , repo , & branch_id ));
271
+ cl_git_pass (git_annotated_commit_lookup (& upstream_head , repo , & upstream_id ));
272
+
273
+ cl_git_pass (git_rebase_init (& rebase , repo , branch_head , upstream_head , NULL , NULL ));
274
+
275
+ cl_git_pass (git_rebase_next (& rebase_operation , rebase ));
276
+ cl_git_pass (git_rebase_commit (& commit_id , rebase , NULL , signature ,
277
+ NULL , NULL ));
278
+
279
+ cl_git_pass (git_commit_lookup (& commit , repo , & commit_id ));
280
+
281
+ git_oid_fromstr (& parent_id , "efad0b11c47cb2f0220cbd6f5b0f93bb99064b00" );
282
+ cl_assert_equal_i (1 , git_commit_parentcount (commit ));
283
+ cl_assert_equal_oid (& parent_id , git_commit_parent_id (commit , 0 ));
284
+
285
+ git_oid_fromstr (& tree_id , "4461379789c777d2a6c1f2ee0e9d6c86731b9992" );
286
+ cl_assert_equal_oid (& tree_id , git_commit_tree_id (commit ));
287
+
288
+ cl_assert_equal_s (NULL , git_commit_message_encoding (commit ));
289
+ cl_assert_equal_s ("Modification 1 to beef\n" , git_commit_message (commit ));
290
+
291
+ cl_git_pass (git_signature_new (& author ,
292
+ "Edward Thomson" ,
"[email protected] " ,
1405621769 ,
0 - (
4 * 60 )));
293
+ cl_assert (git_signature__equal (author , git_commit_author (commit )));
294
+
295
+ cl_assert (git_signature__equal (signature , git_commit_committer (commit )));
296
+
297
+ /* Make sure the reflogs are updated appropriately */
298
+ cl_git_pass (git_reflog_read (& reflog , repo , "HEAD" ));
299
+ cl_assert (reflog_entry = git_reflog_entry_byindex (reflog , 0 ));
300
+ cl_assert_equal_oid (& parent_id , git_reflog_entry_id_old (reflog_entry ));
301
+ cl_assert_equal_oid (& commit_id , git_reflog_entry_id_new (reflog_entry ));
302
+ cl_assert_equal_s ("rebase: Modification 1 to beef" , git_reflog_entry_message (reflog_entry ));
303
+
304
+ git_reflog_free (reflog );
305
+ git_signature_free (author );
306
+ git_commit_free (commit );
307
+ git_annotated_commit_free (branch_head );
308
+ git_annotated_commit_free (upstream_head );
309
+ git_rebase_free (rebase );
310
+ }
311
+
255
312
void test_rebase_merge__blocked_when_dirty (void )
256
313
{
257
314
git_rebase * rebase ;
0 commit comments