From 5e15176dac8b0baa6f7950f5f763608c83b29093 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Sun, 23 May 2010 02:39:57 +0200 Subject: Add commit caching on the commit table. Properly initialize the pending commits list. Signed-off-by: Vicent Marti Signed-off-by: Andreas Ericsson --- src/commit.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/commit.c') diff --git a/src/commit.c b/src/commit.c index 226eca421..1763ca88b 100644 --- a/src/commit.c +++ b/src/commit.c @@ -100,6 +100,10 @@ git_commit *git_commit_lookup(git_revpool *pool, const git_oid *id) if (pool == NULL || pool->db == NULL) return NULL; + commit = (git_commit *)git_revpool_table_lookup(pool->commits, id); + if (commit != NULL) + return commit; + commit = git__malloc(sizeof(git_commit)); if (commit == NULL) @@ -111,6 +115,8 @@ git_commit *git_commit_lookup(git_revpool *pool, const git_oid *id) git_oid_cpy(&commit->object.id, id); commit->object.pool = pool; + git_revpool_table_insert(pool->commits, (git_revpool_object *)commit); + return commit; } -- cgit v1.2.1