summaryrefslogtreecommitdiff
path: root/tests-clar/index/tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar/index/tests.c')
-rw-r--r--tests-clar/index/tests.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests-clar/index/tests.c b/tests-clar/index/tests.c
index a535d6815..cf971e1dd 100644
--- a/tests-clar/index/tests.c
+++ b/tests-clar/index/tests.c
@@ -231,15 +231,19 @@ void test_index_tests__add(void)
cl_git_pass(git_oid_fromstr(&id1, "a8233120f6ad708f843d861ce2b7228ec4e3dec6"));
/* Add the new file to the index */
- cl_git_pass(git_index_add(index, "test.txt", 0));
+ cl_git_pass(git_index_add_from_workdir(index, "test.txt"));
/* Wow... it worked! */
cl_assert(git_index_entrycount(index) == 1);
- entry = git_index_get(index, 0);
+ entry = git_index_get_byindex(index, 0);
/* And the built-in hashing mechanism worked as expected */
cl_assert(git_oid_cmp(&id1, &entry->oid) == 0);
+ /* Test access by path instead of index */
+ cl_assert((entry = git_index_get_bypath(index, "test.txt", 0)) != NULL);
+ cl_assert(git_oid_cmp(&id1, &entry->oid) == 0);
+
git_index_free(index);
git_repository_free(repo);
}