From: Johannes Schindelin Date: Fri, 23 Feb 2024 08:34:24 +0000 (+0000) Subject: cache-tree: avoid an unnecessary check X-Git-Tag: v2.45.0-rc0~132^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5aca024a74e900bd9bc2c14a8e99494063ea4cc5;p=thirdparty%2Fgit.git cache-tree: avoid an unnecessary check The first thing the `parse_tree()` function does is to return early if the tree has already been parsed. Therefore we do not need to guard the `parse_tree()` call behind a check of that flag. As of time of writing, there are no other instances of this in Git's code bases: whenever the `parsed` flag guards a `parse_tree()` call, it guards more than just that call. Suggested-by: Patrick Steinhardt Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- diff --git a/cache-tree.c b/cache-tree.c index c6508b64a5..78d6ba9285 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -779,7 +779,7 @@ static void prime_cache_tree_rec(struct repository *r, struct cache_tree_sub *sub; struct tree *subtree = lookup_tree(r, &entry.oid); - if (!subtree->object.parsed && parse_tree(subtree) < 0) + if (parse_tree(subtree) < 0) exit(128); sub = cache_tree_sub(it, entry.path); sub->cache_tree = cache_tree();