summaryrefslogtreecommitdiff
path: root/src/commit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/commit.c')
-rw-r--r--src/commit.c6
1 files changed, 6 insertions, 0 deletions
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;
}