diff options
author | lhchavez <lhchavez@lhchavez.com> | 2020-07-12 09:53:10 -0700 |
---|---|---|
committer | lhchavez <lhchavez@lhchavez.com> | 2020-07-12 09:53:10 -0700 |
commit | 92d42eb3d83a28febbbb50df7c398e32677da28a (patch) | |
tree | ea0ec85418e34d26046417552e05d6b04fe76c81 | |
parent | d88994da6058f4dc8260e3c16898ad7ab1b61855 (diff) | |
download | libgit2-92d42eb3d83a28febbbb50df7c398e32677da28a.tar.gz |
Minor nits and style formatting
-rw-r--r-- | src/mwindow.c | 5 | ||||
-rw-r--r-- | tests/pack/filelimit.c | 32 |
2 files changed, 18 insertions, 19 deletions
diff --git a/src/mwindow.c b/src/mwindow.c index 10cefbf2a..c257f0c71 100644 --- a/src/mwindow.c +++ b/src/mwindow.c @@ -273,8 +273,9 @@ static int git_mwindow_close_lru_window(void) } /* - * Close the file that does not have any open windows AND contains the - * least-recently-used most-recently-used window. + * Close the file that does not have any open windows AND whose + * most-recently-used window is the least-recently used one across all + * currently open files. * * Called under lock from new_window. */ diff --git a/tests/pack/filelimit.c b/tests/pack/filelimit.c index 43e6176ca..044679f3b 100644 --- a/tests/pack/filelimit.c +++ b/tests/pack/filelimit.c @@ -6,36 +6,36 @@ #include "git2/sys/commit.h" #include "git2/sys/mempack.h" -static size_t _expected_open_mwindow_files = 0; -static size_t _original_mwindow_file_limit = 0; +static size_t expected_open_mwindow_files = 0; +static size_t original_mwindow_file_limit = 0; extern git_mwindow_ctl git_mwindow__mem_ctl; void test_pack_filelimit__initialize_tiny(void) { - _expected_open_mwindow_files = 1; - cl_git_pass(git_libgit2_opts(GIT_OPT_GET_MWINDOW_FILE_LIMIT, &_original_mwindow_file_limit)); - cl_git_pass(git_libgit2_opts(GIT_OPT_SET_MWINDOW_FILE_LIMIT, _expected_open_mwindow_files)); + expected_open_mwindow_files = 1; + cl_git_pass(git_libgit2_opts(GIT_OPT_GET_MWINDOW_FILE_LIMIT, &original_mwindow_file_limit)); + cl_git_pass(git_libgit2_opts(GIT_OPT_SET_MWINDOW_FILE_LIMIT, expected_open_mwindow_files)); } void test_pack_filelimit__initialize_medium(void) { - _expected_open_mwindow_files = 10; - cl_git_pass(git_libgit2_opts(GIT_OPT_GET_MWINDOW_FILE_LIMIT, &_original_mwindow_file_limit)); - cl_git_pass(git_libgit2_opts(GIT_OPT_SET_MWINDOW_FILE_LIMIT, _expected_open_mwindow_files)); + expected_open_mwindow_files = 10; + cl_git_pass(git_libgit2_opts(GIT_OPT_GET_MWINDOW_FILE_LIMIT, &original_mwindow_file_limit)); + cl_git_pass(git_libgit2_opts(GIT_OPT_SET_MWINDOW_FILE_LIMIT, expected_open_mwindow_files)); } void test_pack_filelimit__initialize_unlimited(void) { - _expected_open_mwindow_files = 15; - cl_git_pass(git_libgit2_opts(GIT_OPT_GET_MWINDOW_FILE_LIMIT, &_original_mwindow_file_limit)); + expected_open_mwindow_files = 15; + cl_git_pass(git_libgit2_opts(GIT_OPT_GET_MWINDOW_FILE_LIMIT, &original_mwindow_file_limit)); cl_git_pass(git_libgit2_opts(GIT_OPT_SET_MWINDOW_FILE_LIMIT, 0)); } void test_pack_filelimit__cleanup(void) { git_buf path = GIT_BUF_INIT; - cl_git_pass(git_libgit2_opts(GIT_OPT_SET_MWINDOW_FILE_LIMIT, _original_mwindow_file_limit)); + cl_git_pass(git_libgit2_opts(GIT_OPT_SET_MWINDOW_FILE_LIMIT, original_mwindow_file_limit)); cl_git_pass(git_buf_joinpath(&path, clar_sandbox_path(), "repo.git")); cl_fixture_cleanup(path.ptr); @@ -105,8 +105,8 @@ void test_pack_filelimit__open_repo_with_multiple_packfiles(void) */ cl_git_pass(git_buf_joinpath(&path, clar_sandbox_path(), "repo.git")); cl_git_pass(git_repository_init(&repo, path.ptr, true)); - for (i = 1; i <= commit_count; ++i) { - create_packfile_commit(repo, &id, parent_id, i, commit_count); + for (i = 0; i < commit_count; ++i) { + create_packfile_commit(repo, &id, parent_id, i + 1, commit_count); parent_id = &id; } @@ -114,9 +114,7 @@ void test_pack_filelimit__open_repo_with_multiple_packfiles(void) cl_git_pass(git_revwalk_sorting(walk, GIT_SORT_TOPOLOGICAL)); cl_git_pass(git_revwalk_push_ref(walk, "refs/heads/master")); - /* - * Walking the repository requires eventually opening each of the packfiles. - */ + /* Walking the repository requires eventually opening each of the packfiles. */ i = 0; while (git_revwalk_next(&id, walk) == 0) ++i; @@ -130,7 +128,7 @@ void test_pack_filelimit__open_repo_with_multiple_packfiles(void) open_windows = ctl->open_windows; cl_git_pass(git_mutex_unlock(&git__mwindow_mutex)); - cl_assert_equal_i(_expected_open_mwindow_files, open_windows); + cl_assert_equal_i(expected_open_mwindow_files, open_windows); git_buf_dispose(&path); git_revwalk_free(walk); |