summaryrefslogtreecommitdiff
path: root/src/commit.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-05-16 01:52:31 +0200
committerAndreas Ericsson <ae@op5.se>2010-06-02 10:32:06 +0200
commit42281e007e15713713b2ff4324d60360332e194e (patch)
treebc5aba43f785c144c9b5c6406ffbce6a7fec5304 /src/commit.c
parent4caa8962a6af9fac72ab81afb03779bc3acff910 (diff)
downloadlibgit2-42281e007e15713713b2ff4324d60360332e194e.tar.gz
Add unit tests for Commit parsing
A few initial tests for commit parsing: "parse_buffer_test" tests git_commit__parse_buffer() with several malformed commit messages and a few corner cases which should pass. "parse_oid_test" tests git_commit__parse_oid() with several malformed commit lines containing broken SHA1 OIDs. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Diffstat (limited to 'src/commit.c')
-rw-r--r--src/commit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/commit.c b/src/commit.c
index bbb0d9be..1b30c5d6 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -40,6 +40,9 @@ git_commit *git_commit_lookup(git_revpool *pool, const git_oid *id)
git_obj commit_obj;
git_commit *commit = NULL;
+ if (pool == NULL || pool->db == NULL)
+ return NULL;
+
/*
* TODO: check if the commit is already cached in the
* revpool instead of loading it from the odb