[PATCH 05/12] bloom: parse commit before computing filters
- From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
- Date
- May 1, 2020, 15:30 UTC
- Message-ID
- <ef4c08e401bd57dddf327910032220632a36885f.1588347029.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.622.git.1588347029.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>
When computing changed-path Bloom filters for a commit, we need to know if the commit has a parent or not. If the commit is not parsed, then its parent pointer will be NULL.
As far as I can tell, the only opportunity to reach this code without parsing the commit is inside "test-tool bloom get_filter_for_commit" but it is best to be safe.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com> --- bloom.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/bloom.c b/bloom.c index eb08571c628..c3b81b1a38a 100644 --- a/bloom.c +++ b/bloom.c @@ -206,6 +206,9 @@ struct bloom_filter *get_bloom_filter(struct repository *r, diffopt.max_changes = max_changes; diff_setup_done(&diffopt); + /* ensure commit is parsed so we have parent information */ + parse_commit(c); + if (c->parents) diff_tree_oid(&c->parents->item->object.oid, &c->object.oid, "", &diffopt); else
-- gitgitgadget