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.
This commit is contained in:
Patrick Steinhardt
2017-05-12 10:04:42 +02:00
parent fea0c81e95
commit 82368b1bad
13 changed files with 30 additions and 0 deletions

View File

@@ -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;

View File

@@ -0,0 +1 @@
ref: refs/heads/master

View File

@@ -0,0 +1,5 @@
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true

Binary file not shown.

View File

@@ -0,0 +1 @@
b0952dbb50bed5f01e03e31b296184cb183e54a7

View File

View File

View File

View File

View File