mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
commit-graph: return commit graph from repo_find_commit_pos_in_graph()
The function `repo_find_commit_pos_in_graph()` takes a commit as input and tries to figure out whether the given repository has a commit graph that contains that specific commit. If so, it returns the corresponding position of that commit inside the graph. Right now though we only return the position, but not the actual graph that the commit has been found in. This is sensible as repositories always have the graph in `struct repository::objects::commit_graph`. Consequently, the caller always knows where to find it. But in a subsequent change we're going to move the graph into the object sources. This would require callers of the function to loop through all sources to find the relevant commit graph. Refactor the code so that we instead return the commit-graph that the commit has been found with. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
199d452758
commit
88bc3500e5
8
bloom.c
8
bloom.c
@@ -452,10 +452,12 @@ struct bloom_filter *get_or_compute_bloom_filter(struct repository *r,
|
||||
filter = bloom_filter_slab_at(&bloom_filters, c);
|
||||
|
||||
if (!filter->data) {
|
||||
struct commit_graph *g;
|
||||
uint32_t graph_pos;
|
||||
if (repo_find_commit_pos_in_graph(r, c, &graph_pos))
|
||||
load_bloom_filter_from_graph(r->objects->commit_graph,
|
||||
filter, graph_pos);
|
||||
|
||||
g = repo_find_commit_pos_in_graph(r, c, &graph_pos);
|
||||
if (g)
|
||||
load_bloom_filter_from_graph(g, filter, graph_pos);
|
||||
}
|
||||
|
||||
if (filter->data && filter->len) {
|
||||
|
||||
Reference in New Issue
Block a user