Commit 82368b1b by Patrick Steinhardt

tests: index::version: add test to read index version v4

While we have a simple test to determine whether we can write an index
of version 4, we never verified that we are able to read this kind of
index (and in fact, we were not able to do so). Add a new repository
which has an index of version 4. This repository is then read from a new
test.
parent fea0c81e
......@@ -9,6 +9,29 @@ void test_index_version__cleanup(void)
g_repo = NULL;
}
void test_index_version__can_read_v4(void)
{
const char *paths[] = {
"file.tx", "file.txt", "file.txz", "foo", "zzz",
};
git_index *index;
size_t i;
g_repo = cl_git_sandbox_init("indexv4");
cl_git_pass(git_repository_index(&index, g_repo));
cl_assert_equal_sz(git_index_entrycount(index), 5);
for (i = 0; i < ARRAY_SIZE(paths); i++) {
const git_index_entry *entry =
git_index_get_bypath(index, paths[i], GIT_INDEX_STAGE_NORMAL);
cl_assert(entry != NULL);
}
git_index_free(index);
}
void test_index_version__can_write_v4(void)
{
git_index *index;
......
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
b0952dbb50bed5f01e03e31b296184cb183e54a7
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment