diff options
author | Patrick Wang <mail6543210@yahoo.com.tw> | 2020-05-26 20:36:13 +0800 |
---|---|---|
committer | Patrick Wang <mail6543210@yahoo.com.tw> | 2020-05-27 03:51:15 +0800 |
commit | 1a8990082aeeb1fbf6028d7c2b480f3086c87307 (patch) | |
tree | 544424209dfe346c332fdcda18a32d26fa5a0bd9 /tests/index | |
parent | 8c96d56dd0af7e7186a93915c33eda6758a9da3c (diff) | |
download | libgit2-1a8990082aeeb1fbf6028d7c2b480f3086c87307.tar.gz |
tests: index::version: write v4 index: re-open repo to read written v4 index
The `git_index_free()` merely decrement the reference counter from 2 to
1, and does not "free" the index.
Thus, the following `git_repository_index()` merely increase the counter
to 2, instead of read index from disk.
The written index is not read and parsed, which makes this test case
effectively becomes a no-op.
Diffstat (limited to 'tests/index')
-rw-r--r-- | tests/index/version.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/index/version.c b/tests/index/version.c index 3827df861..b6c0b7918 100644 --- a/tests/index/version.c +++ b/tests/index/version.c @@ -43,6 +43,7 @@ void test_index_version__can_write_v4(void) "xz", "xyzzyx" }; + git_repository *repo; git_index_entry entry; git_index *index; size_t i; @@ -63,7 +64,8 @@ void test_index_version__can_write_v4(void) cl_git_pass(git_index_write(index)); git_index_free(index); - cl_git_pass(git_repository_index(&index, g_repo)); + cl_git_pass(git_repository_open(&repo, git_repository_path(g_repo))); + cl_git_pass(git_repository_index(&index, repo)); cl_assert(git_index_version(index) == 4); for (i = 0; i < ARRAY_SIZE(paths); i++) { @@ -74,6 +76,7 @@ void test_index_version__can_write_v4(void) } git_index_free(index); + git_repository_free(repo); } void test_index_version__v4_uses_path_compression(void) |