33#include "fileops.h"
44#include "git2/reflog.h"
55#include "reflog.h"
6+ #include "reflog_helpers.h"
67
78static const char * new_ref = "refs/heads/test-reflog" ;
89static const char * current_master_tip = "a65fedf39aefe402d3bb6e24df4d4f5fe4547750" ;
@@ -103,12 +104,15 @@ void test_refs_reflog_reflog__renaming_the_reference_moves_the_reflog(void)
103104{
104105 git_reference * master , * new_master ;
105106 git_buf master_log_path = GIT_BUF_INIT , moved_log_path = GIT_BUF_INIT ;
107+ size_t old_count ;
106108
107109 git_buf_joinpath (& master_log_path , git_repository_path (g_repo ), GIT_REFLOG_DIR );
108110 git_buf_puts (& moved_log_path , git_buf_cstr (& master_log_path ));
109111 git_buf_joinpath (& master_log_path , git_buf_cstr (& master_log_path ), "refs/heads/master" );
110112 git_buf_joinpath (& moved_log_path , git_buf_cstr (& moved_log_path ), "refs/moved" );
111113
114+ old_count = reflog_entrycount (g_repo , "refs/heads/master" );
115+
112116 cl_assert_equal_i (true, git_path_isfile (git_buf_cstr (& master_log_path )));
113117 cl_assert_equal_i (false, git_path_isfile (git_buf_cstr (& moved_log_path )));
114118
@@ -118,6 +122,7 @@ void test_refs_reflog_reflog__renaming_the_reference_moves_the_reflog(void)
118122
119123 cl_assert_equal_i (false, git_path_isfile (git_buf_cstr (& master_log_path )));
120124 cl_assert_equal_i (true, git_path_isfile (git_buf_cstr (& moved_log_path )));
125+ cl_assert_equal_i (old_count + 1 , reflog_entrycount (g_repo , "refs/moved" ));
121126
122127 git_reference_free (new_master );
123128 git_buf_free (& moved_log_path );
0 commit comments