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) {
}
}
-int repo_find_commit_pos_in_graph(struct repository *r, struct commit *c,
- uint32_t *pos)
+struct commit_graph *repo_find_commit_pos_in_graph(struct repository *r,
+ struct commit *c,
+ uint32_t *pos)
{
struct commit_graph *g = prepare_commit_graph(r);
if (!g)
- return 0;
- return find_commit_pos_in_graph(c, g, pos);
+ return NULL;
+ if (!find_commit_pos_in_graph(c, g, pos))
+ return NULL;
+ return g;
}
struct commit *lookup_commit_in_graph(struct repository *repo, const struct object_id *id)
void load_commit_graph_info(struct repository *r, struct commit *item)
{
+ struct commit_graph *g;
uint32_t pos;
- if (repo_find_commit_pos_in_graph(r, item, &pos))
- fill_commit_graph_info(item, r->objects->commit_graph, pos);
+
+ g = repo_find_commit_pos_in_graph(r, item, &pos);
+ if (g)
+ fill_commit_graph_info(item, g, pos);
}
static struct tree *load_tree_for_commit(struct commit_graph *g,
int parse_commit_in_graph(struct repository *r, struct commit *item);
/*
- * Fills `*pos` with the graph position of `c`, and returns 1 if `c` is
- * found in the commit-graph belonging to `r`, or 0 otherwise.
- * Initializes the commit-graph belonging to `r` if it hasn't been
- * already.
+ * Fills `*pos` with the graph position of `c`, and returns the graph `c` is
+ * found in, or NULL otherwise. Initializes the commit-graphs belonging to
+ * `r` if it hasn't been already.
*
* Note: this is a low-level helper that does not alter any slab data
* associated with `c`. Useful in circumstances where the slab data is
*
* In most cases, callers should use `parse_commit_in_graph()` instead.
*/
-int repo_find_commit_pos_in_graph(struct repository *r, struct commit *c,
- uint32_t *pos);
+struct commit_graph *repo_find_commit_pos_in_graph(struct repository *r,
+ struct commit *c,
+ uint32_t *pos);
/*
* Look up the given commit ID in the commit-graph. This will only return a