diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2018-04-06 19:09:34 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-11 10:47:16 +0900 |
commit | 5bb03de102b40d9e564be3a3a39084a550db79cb (patch) | |
tree | 7966ce4d4471cb332d0610bd1cce4d3fbb431d19 /commit.c | |
parent | treewide: rename tree to maybe_tree (diff) | |
download | tgif-5bb03de102b40d9e564be3a3a39084a550db79cb.tar.xz |
commit: create get_commit_tree() method
While walking the commit graph, we load struct commit objects into
the object cache. During this process, we also load struct tree
objects for the root tree of each of these commits. We load these
objects even if we are only computing commit reachability information,
such as a merge base or ahead/behind information.
Create get_commit_tree() as a first step to removing direct
references to the 'maybe_tree' member of struct commit.
Create get_commit_tree_oid() as a shortcut for several references
to "&commit->maybe_tree->object.oid" in the codebase.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -296,6 +296,16 @@ void free_commit_buffer(struct commit *commit) } } +struct tree *get_commit_tree(const struct commit *commit) +{ + return commit->maybe_tree; +} + +struct object_id *get_commit_tree_oid(const struct commit *commit) +{ + return &get_commit_tree(commit)->object.oid; +} + const void *detach_commit_buffer(struct commit *commit, unsigned long *sizep) { struct commit_buffer *v = buffer_slab_peek(&buffer_slab, commit); |