diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-05-23 07:38:13 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-23 07:38:13 +0200 |
commit | c89b6e136e421f1e9108b3c5bc050b19b0243844 (patch) | |
tree | 8d81e022f855aad5d29853b56b886d3c6b382c45 /fsck.c | |
parent | Merge branch 'nd/term-columns' (diff) | |
parent | coccinelle: avoid wrong transformation suggestions from commit.cocci (diff) | |
download | git-c89b6e136e421f1e9108b3c5bc050b19b0243844.tar.xz git-c89b6e136e421f1e9108b3c5bc050b19b0243844.zip |
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 'fsck.c')
-rw-r--r-- | fsck.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -396,9 +396,11 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio name = get_object_name(options, &commit->object); if (name) - put_object_name(options, &commit->tree->object, "%s:", name); + put_object_name(options, &get_commit_tree(commit)->object, + "%s:", name); - result = options->walk((struct object *)commit->tree, OBJ_TREE, data, options); + result = options->walk((struct object *)get_commit_tree(commit), + OBJ_TREE, data, options); if (result < 0) return result; res = result; @@ -772,7 +774,7 @@ static int fsck_commit_buffer(struct commit *commit, const char *buffer, err = fsck_ident(&buffer, &commit->object, options); if (err) return err; - if (!commit->tree) { + if (!get_commit_tree(commit)) { err = report(options, &commit->object, FSCK_MSG_BAD_TREE, "could not load commit's tree %s", sha1_to_hex(tree_sha1)); if (err) return err; |