@@ -7,6 +7,8 @@ static const char *commit_message = "This commit has been created in memory\n\
77static const char * tree_oid = "1810dff58d8a660512d4832e740f692884338ccd" ;
88static const char * root_commit_message = "This is a root commit\n\
99 This is a root commit and should be the only one in this branch\n" ;
10+ static const char * root_reflog_message = "commit (initial): This is a root commit \
11+ This is a root commit and should be the only one in this branch" ;
1012static char * head_old ;
1113static git_reference * head , * branch ;
1214static git_commit * commit ;
@@ -101,6 +103,8 @@ void test_commit_write__root(void)
101103 git_signature * author , * committer ;
102104 const char * branch_name = "refs/heads/root-commit-branch" ;
103105 git_tree * tree ;
106+ git_reflog * log ;
107+ const git_reflog_entry * entry ;
104108
105109 git_oid_fromstr (& tree_id , tree_oid );
106110 cl_git_pass (git_tree_lookup (& tree , g_repo , & tree_id ));
@@ -130,7 +134,6 @@ void test_commit_write__root(void)
130134 0 ));
131135
132136 git_object_free ((git_object * )tree );
133- git_signature_free (committer );
134137 git_signature_free (author );
135138
136139 /*
@@ -144,4 +147,14 @@ void test_commit_write__root(void)
144147 branch_oid = git_reference_target (branch );
145148 cl_git_pass (git_oid_cmp (branch_oid , & commit_id ));
146149 cl_assert_equal_s (root_commit_message , git_commit_message (commit ));
150+
151+ cl_git_pass (git_reflog_read (& log , g_repo , branch_name ));
152+ cl_assert_equal_i (1 , git_reflog_entrycount (log ));
153+ entry = git_reflog_entry_byindex (log , 0 );
154+ cl_assert_equal_s (committer -> email , git_reflog_entry_committer (entry )-> email );
155+ cl_assert_equal_s (committer -> name , git_reflog_entry_committer (entry )-> name );
156+ cl_assert_equal_s (root_reflog_message , git_reflog_entry_message (entry ));
157+
158+ git_signature_free (committer );
159+ git_reflog_free (log );
147160}
0 commit comments