diff options
author | Vicent Marti <tanoku@gmail.com> | 2010-05-23 02:39:57 +0200 |
---|---|---|
committer | Andreas Ericsson <ae@op5.se> | 2010-06-02 10:32:06 +0200 |
commit | 5e15176dac8b0baa6f7950f5f763608c83b29093 (patch) | |
tree | 5bcc94ea49a378e97626436c5b28be17b54eeac6 /src/commit.c | |
parent | c5696427b6d53a3f79baad35ea33c556884a410a (diff) | |
download | libgit2-5e15176dac8b0baa6f7950f5f763608c83b29093.tar.gz |
Add commit caching on the commit table.
Properly initialize the pending commits list.
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.c | 6 |
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; } |