diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-06-25 13:22:38 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-06-25 13:22:38 -0700 |
commit | 110240588d5c0ca88d3b55da52068f59d8d6367d (patch) | |
tree | 5a9120c2c70aeb9d2e7ac4347870094870019e49 /commit.c | |
parent | fa82bb70d9ef3acb6a47cddfb38a7b0ca40ac362 (diff) | |
parent | 14ba97f81c7b94e10d591b363688a073023f332d (diff) | |
download | git-110240588d5c0ca88d3b55da52068f59d8d6367d.tar.gz |
Merge branch 'sb/object-store-alloc'
The conversion to pass "the_repository" and then "a_repository"
throughout the object access API continues.
* sb/object-store-alloc:
alloc: allow arbitrary repositories for alloc functions
object: allow create_object to handle arbitrary repositories
object: allow grow_object_hash to handle arbitrary repositories
alloc: add repository argument to alloc_commit_index
alloc: add repository argument to alloc_report
alloc: add repository argument to alloc_object_node
alloc: add repository argument to alloc_tag_node
alloc: add repository argument to alloc_commit_node
alloc: add repository argument to alloc_tree_node
alloc: add repository argument to alloc_blob_node
object: add repository argument to grow_object_hash
object: add repository argument to create_object
repository: introduce parsed objects field
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -7,6 +7,7 @@ #include "diff.h" #include "revision.h" #include "notes.h" +#include "alloc.h" #include "gpg-interface.h" #include "mergesort.h" #include "commit-slab.h" @@ -52,7 +53,8 @@ struct commit *lookup_commit(const struct object_id *oid) { struct object *obj = lookup_object(oid->hash); if (!obj) - return create_object(oid->hash, alloc_commit_node()); + return create_object(the_repository, oid->hash, + alloc_commit_node(the_repository)); return object_as_type(obj, OBJ_COMMIT, 0); } @@ -325,6 +327,17 @@ struct object_id *get_commit_tree_oid(const struct commit *commit) return &get_commit_tree(commit)->object.oid; } +void release_commit_memory(struct commit *c) +{ + c->maybe_tree = NULL; + c->index = 0; + free_commit_buffer(c); + free_commit_list(c->parents); + /* TODO: what about commit->util? */ + + c->object.parsed = 0; +} + const void *detach_commit_buffer(struct commit *commit, unsigned long *sizep) { struct commit_buffer *v = buffer_slab_peek(&buffer_slab, commit); |