Re: [PATCH 4/4] Always check `parse_tree*()`'s return value
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Feb 7, 2024, 07:42 UTC
- Message-ID
- <ZcM0blqMPppLn2oB@tanuki>
- In-Reply-To
- <93abd7000b81bbcd7f5422715b4bbb60c69a7cde.1707212981.git.gitgitgadget@gmail.com>
On Tue, Feb 06, 2024 at 09:49:41AM +0000, Johannes Schindelin via GitGitGadget wrote:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
[snip]
Show 12 quoted lines
> diff --git a/cache-tree.c b/cache-tree.c > index 641427ed410..c6508b64a5c 100644 > --- a/cache-tree.c > +++ b/cache-tree.c > @@ -779,8 +779,8 @@ 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); > + if (!subtree->object.parsed && parse_tree(subtree) < 0) > + exit(128);
It's somewhat weird that we have the `subtree->object.parsed` check in the first place, because the first thing that `parse_tree_gently()` does is to check that flag and immediately return when the tree is parsed already. It's a preexisting issue though, so this is fine.
Patrick