summaryrefslogtreecommitdiff
path: root/tests/t0401-parse.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-09-20 01:57:53 +0300
committerVicent Marti <tanoku@gmail.com>2010-09-20 02:04:06 +0300
commit0c3596f18a6f07d8a61f8d6e2fd730a276a51599 (patch)
tree02add71c1efc95d8c9eead36edca9b2996f5d602 /tests/t0401-parse.c
parente802d8cca8b7fddb8ae157b84fb7c1e84671546d (diff)
downloadlibgit2-0c3596f18a6f07d8a61f8d6e2fd730a276a51599.tar.gz
Add setter methods & write support for git_commit
All the required git_commit_set_XXX methods have been implemented; all the attributes of a commit object can now be modified in-memory. The new method git_object_write() automatically writes back the in-memory changes of any object to the repository. So far it only supports git_commit objects. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'tests/t0401-parse.c')
-rw-r--r--tests/t0401-parse.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/tests/t0401-parse.c b/tests/t0401-parse.c
index d9b3a2a56..d97aee11e 100644
--- a/tests/t0401-parse.c
+++ b/tests/t0401-parse.c
@@ -5,6 +5,8 @@
#include <git/commit.h>
#include <git/revwalk.h>
+static const char *odb_dir = "../resources/pack-odb";
+
static char *test_commits_broken[] = {
/* empty commit */
@@ -58,21 +60,20 @@ par",
static char *test_commits_working[] = {
/* simple commit with no message */
-"tree f6c0dad3c7b3481caa9d73db21f91964894a945b\n\
+"tree 1810dff58d8a660512d4832e740f692884338ccd\n\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
\n",
/* simple commit, no parent */
-"tree f6c0dad3c7b3481caa9d73db21f91964894a945b\n\
+"tree 1810dff58d8a660512d4832e740f692884338ccd\n\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
\n\
a simple commit which works\n",
/* simple commit, 1 parents */
-"tree f6c0dad3c7b3481caa9d73db21f91964894a945b\n\
-parent a4a7dce85cf63874e984719f4fdd239f5145052f\n\
+"tree 1810dff58d8a660512d4832e740f692884338ccd\n\
author Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
committer Vicent Marti <tanoku@gmail.com> 1273848544 +0200\n\
\n\
@@ -216,16 +217,13 @@ BEGIN_TEST(parse_buffer_test)
const int broken_commit_count = sizeof(test_commits_broken) / sizeof(*test_commits_broken);
const int working_commit_count = sizeof(test_commits_working) / sizeof(*test_commits_working);
- const unsigned int default_flags =
- GIT_COMMIT_AUTHOR |
- GIT_COMMIT_COMMITTER |
- GIT_COMMIT_TIME |
- GIT_COMMIT_MESSAGE |
- GIT_COMMIT_MESSAGE_SHORT; /* parse everything */
-
int i;
- git_repository *repo = git_repository_alloc(NULL);
+ git_repository *repo;
+ git_odb *db;
+
+ must_pass(git_odb_open(&db, odb_dir));
+ repo = git_repository_alloc(db);
must_be_true(repo != NULL);
for (i = 0; i < broken_commit_count; ++i) {
@@ -238,7 +236,7 @@ BEGIN_TEST(parse_buffer_test)
commit,
test_commits_broken[i],
strlen(test_commits_broken[i]),
- default_flags)
+ 0x1)
);
git_commit__free(commit);
@@ -254,7 +252,7 @@ BEGIN_TEST(parse_buffer_test)
commit,
test_commits_working[i],
strlen(test_commits_working[i]),
- default_flags)
+ 0x1)
);
git_commit__free(commit);