summaryrefslogtreecommitdiff
path: root/tests/t0901-readtree.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-11-02 18:42:42 +0200
committerVicent Marti <tanoku@gmail.com>2010-11-02 18:42:42 +0200
commit6fd195d76c7f52baae5540e287affe2259900d36 (patch)
tree4dd644c5086dce17827f42b8c811049175da88f9 /tests/t0901-readtree.c
parentd80e9d55aa2d0629f7f207db42762494075d7854 (diff)
downloadlibgit2-6fd195d76c7f52baae5540e287affe2259900d36.tar.gz
Change git_repository initialization to use a path
The constructor to git_repository is now called 'git_repository_open(path)' and takes a path to a git repository instead of an existing ODB object. Unit tests have been updated accordingly and the two test repositories have been merged into one. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'tests/t0901-readtree.c')
-rw-r--r--tests/t0901-readtree.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/tests/t0901-readtree.c b/tests/t0901-readtree.c
index eba6ecf46..e3a85c52d 100644
--- a/tests/t0901-readtree.c
+++ b/tests/t0901-readtree.c
@@ -6,18 +6,14 @@
#include <git/commit.h>
#include <git/revwalk.h>
-static const char *odb_dir = "../resources/sample-odb";
static const char *tree_oid = "1810dff58d8a660512d4832e740f692884338ccd";
BEGIN_TEST(tree_entry_access_test)
- git_odb *db;
git_oid id;
git_repository *repo;
git_tree *tree;
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
git_oid_mkstr(&id, tree_oid);
@@ -34,19 +30,15 @@ BEGIN_TEST(tree_entry_access_test)
must_be_true(git_tree_entry_byindex(tree, -1) == NULL);
git_repository_free(repo);
- git_odb_close(db);
END_TEST
BEGIN_TEST(tree_read_test)
- git_odb *db;
git_oid id;
git_repository *repo;
git_tree *tree;
git_tree_entry *entry;
- must_pass(git_odb_open(&db, odb_dir));
-
- repo = git_repository_alloc(db);
+ repo = git_repository_open(REPOSITORY_FOLDER);
must_be_true(repo != NULL);
git_oid_mkstr(&id, tree_oid);
@@ -61,9 +53,7 @@ BEGIN_TEST(tree_read_test)
must_be_true(strcmp(git_tree_entry_name(entry), "README") == 0);
-
must_be_true(git_tree_entry_2object(entry) != NULL);
git_repository_free(repo);
- git_odb_close(db);
END_TEST