Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
92d42eb3
Commit
92d42eb3
authored
Jul 12, 2020
by
lhchavez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor nits and style formatting
parent
d88994da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
19 deletions
+18
-19
src/mwindow.c
+3
-2
tests/pack/filelimit.c
+15
-17
No files found.
src/mwindow.c
View file @
92d42eb3
...
...
@@ -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.
*/
...
...
tests/pack/filelimit.c
View file @
92d42eb3
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment