diff options
| author | Junio C Hamano <gitster@pobox.com> | 2018-05-23 14:38:13 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2018-05-23 14:38:13 +0900 |
| commit | c89b6e136e421f1e9108b3c5bc050b19b0243844 (patch) | |
| tree | 8d81e022f855aad5d29853b56b886d3c6b382c45 /commit.h | |
| parent | 05682ee270199fdfbc11883458b3639b2b1577df (diff) | |
| parent | 279ffad17dcc3b72aa7cb5c73fb7aa8eddeed9da (diff) | |
| download | git-c89b6e136e421f1e9108b3c5bc050b19b0243844.tar.gz | |
Merge branch 'ds/lazy-load-trees'
The code has been taught to use the duplicated information stored
in the commit-graph file to learn the tree object name for a commit
to avoid opening and parsing the commit object when it makes sense
to do so.
* ds/lazy-load-trees:
coccinelle: avoid wrong transformation suggestions from commit.cocci
commit-graph: lazy-load trees for commits
treewide: replace maybe_tree with accessor methods
commit: create get_commit_tree() method
treewide: rename tree to maybe_tree
Diffstat (limited to 'commit.h')
| -rw-r--r-- | commit.h | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -22,7 +22,13 @@ struct commit { unsigned int index; timestamp_t date; struct commit_list *parents; - struct tree *tree; + + /* + * If the commit is loaded from the commit-graph file, then this + * member may be NULL. Only access it through get_commit_tree() + * or get_commit_tree_oid(). + */ + struct tree *maybe_tree; uint32_t graph_pos; }; @@ -102,6 +108,9 @@ void unuse_commit_buffer(const struct commit *, const void *buffer); */ void free_commit_buffer(struct commit *); +struct tree *get_commit_tree(const struct commit *); +struct object_id *get_commit_tree_oid(const struct commit *); + /* * Disassociate any cached object buffer from the commit, but do not free it. * The buffer (or NULL, if none) is returned. |
