66#include "git2/sys/commit.h"
77#include "git2/sys/mempack.h"
88
9- static size_t _expected_open_mwindow_files = 0 ;
10- static size_t _original_mwindow_file_limit = 0 ;
9+ static size_t expected_open_mwindow_files = 0 ;
10+ static size_t original_mwindow_file_limit = 0 ;
1111
1212extern git_mwindow_ctl git_mwindow__mem_ctl ;
1313
1414void test_pack_filelimit__initialize_tiny (void )
1515{
16- _expected_open_mwindow_files = 1 ;
17- cl_git_pass (git_libgit2_opts (GIT_OPT_GET_MWINDOW_FILE_LIMIT , & _original_mwindow_file_limit ));
18- cl_git_pass (git_libgit2_opts (GIT_OPT_SET_MWINDOW_FILE_LIMIT , _expected_open_mwindow_files ));
16+ expected_open_mwindow_files = 1 ;
17+ cl_git_pass (git_libgit2_opts (GIT_OPT_GET_MWINDOW_FILE_LIMIT , & original_mwindow_file_limit ));
18+ cl_git_pass (git_libgit2_opts (GIT_OPT_SET_MWINDOW_FILE_LIMIT , expected_open_mwindow_files ));
1919}
2020
2121void test_pack_filelimit__initialize_medium (void )
2222{
23- _expected_open_mwindow_files = 10 ;
24- cl_git_pass (git_libgit2_opts (GIT_OPT_GET_MWINDOW_FILE_LIMIT , & _original_mwindow_file_limit ));
25- cl_git_pass (git_libgit2_opts (GIT_OPT_SET_MWINDOW_FILE_LIMIT , _expected_open_mwindow_files ));
23+ expected_open_mwindow_files = 10 ;
24+ cl_git_pass (git_libgit2_opts (GIT_OPT_GET_MWINDOW_FILE_LIMIT , & original_mwindow_file_limit ));
25+ cl_git_pass (git_libgit2_opts (GIT_OPT_SET_MWINDOW_FILE_LIMIT , expected_open_mwindow_files ));
2626}
2727
2828void test_pack_filelimit__initialize_unlimited (void )
2929{
30- _expected_open_mwindow_files = 15 ;
31- cl_git_pass (git_libgit2_opts (GIT_OPT_GET_MWINDOW_FILE_LIMIT , & _original_mwindow_file_limit ));
30+ expected_open_mwindow_files = 15 ;
31+ cl_git_pass (git_libgit2_opts (GIT_OPT_GET_MWINDOW_FILE_LIMIT , & original_mwindow_file_limit ));
3232 cl_git_pass (git_libgit2_opts (GIT_OPT_SET_MWINDOW_FILE_LIMIT , 0 ));
3333}
3434
3535void test_pack_filelimit__cleanup (void )
3636{
3737 git_buf path = GIT_BUF_INIT ;
38- cl_git_pass (git_libgit2_opts (GIT_OPT_SET_MWINDOW_FILE_LIMIT , _original_mwindow_file_limit ));
38+ cl_git_pass (git_libgit2_opts (GIT_OPT_SET_MWINDOW_FILE_LIMIT , original_mwindow_file_limit ));
3939
4040 cl_git_pass (git_buf_joinpath (& path , clar_sandbox_path (), "repo.git" ));
4141 cl_fixture_cleanup (path .ptr );
@@ -105,18 +105,16 @@ void test_pack_filelimit__open_repo_with_multiple_packfiles(void)
105105 */
106106 cl_git_pass (git_buf_joinpath (& path , clar_sandbox_path (), "repo.git" ));
107107 cl_git_pass (git_repository_init (& repo , path .ptr , true));
108- for (i = 1 ; i <= commit_count ; ++ i ) {
109- create_packfile_commit (repo , & id , parent_id , i , commit_count );
108+ for (i = 0 ; i < commit_count ; ++ i ) {
109+ create_packfile_commit (repo , & id , parent_id , i + 1 , commit_count );
110110 parent_id = & id ;
111111 }
112112
113113 cl_git_pass (git_revwalk_new (& walk , repo ));
114114 cl_git_pass (git_revwalk_sorting (walk , GIT_SORT_TOPOLOGICAL ));
115115 cl_git_pass (git_revwalk_push_ref (walk , "refs/heads/master" ));
116116
117- /*
118- * Walking the repository requires eventually opening each of the packfiles.
119- */
117+ /* Walking the repository requires eventually opening each of the packfiles. */
120118 i = 0 ;
121119 while (git_revwalk_next (& id , walk ) == 0 )
122120 ++ i ;
@@ -130,7 +128,7 @@ void test_pack_filelimit__open_repo_with_multiple_packfiles(void)
130128 open_windows = ctl -> open_windows ;
131129 cl_git_pass (git_mutex_unlock (& git__mwindow_mutex ));
132130
133- cl_assert_equal_i (_expected_open_mwindow_files , open_windows );
131+ cl_assert_equal_i (expected_open_mwindow_files , open_windows );
134132
135133 git_buf_dispose (& path );
136134 git_revwalk_free (walk );
0 commit comments