summaryrefslogtreecommitdiff
path: root/tests-clar/index/tests.c
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2012-10-30 11:51:58 -0700
committerVicent Martí <vicent@github.com>2012-10-30 11:51:58 -0700
commit6c21358a89efe5d4b8c5ab26dd707500653ba911 (patch)
tree1ab30e4eafa3cff21fb8d6564bcb788b3b03aab6 /tests-clar/index/tests.c
parent6cfbbf7e3205e902bd94bf16743127c705e3e588 (diff)
parentf45ec1a076e2347ba5d63eeb2d158f87b612e5cb (diff)
downloadlibgit2-6c21358a89efe5d4b8c5ab26dd707500653ba911.tar.gz
Merge pull request #1029 from ethomson/index_refactor
Index changes
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);
}