commit: move members graph_pos, generation to a slab
We remove members `graph_pos` and `generation` from the struct commit. The default assignments in init_commit_node() are no longer valid, which is fine as the slab helpers return appropriate default values and the assignments are removed. We will replace existing use of commit->generation and commit->graph_pos by commit_graph_data_slab helpers using `contrib/coccinelle/commit.cocci'. Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
4844812b9e
commit
c49c82aa4c
16
revision.c
16
revision.c
@ -725,7 +725,7 @@ static int check_maybe_different_in_bloom_filter(struct rev_info *revs,
|
||||
if (!revs->repo->objects->commit_graph)
|
||||
return -1;
|
||||
|
||||
if (commit->generation == GENERATION_NUMBER_INFINITY)
|
||||
if (commit_graph_generation(commit) == GENERATION_NUMBER_INFINITY)
|
||||
return -1;
|
||||
|
||||
filter = get_bloom_filter(revs->repo, commit, 0);
|
||||
@ -3320,7 +3320,7 @@ static void explore_to_depth(struct rev_info *revs,
|
||||
struct topo_walk_info *info = revs->topo_walk_info;
|
||||
struct commit *c;
|
||||
while ((c = prio_queue_peek(&info->explore_queue)) &&
|
||||
c->generation >= gen_cutoff)
|
||||
commit_graph_generation(c) >= gen_cutoff)
|
||||
explore_walk_step(revs);
|
||||
}
|
||||
|
||||
@ -3336,7 +3336,7 @@ static void indegree_walk_step(struct rev_info *revs)
|
||||
if (parse_commit_gently(c, 1) < 0)
|
||||
return;
|
||||
|
||||
explore_to_depth(revs, c->generation);
|
||||
explore_to_depth(revs, commit_graph_generation(c));
|
||||
|
||||
for (p = c->parents; p; p = p->next) {
|
||||
struct commit *parent = p->item;
|
||||
@ -3360,7 +3360,7 @@ static void compute_indegrees_to_depth(struct rev_info *revs,
|
||||
struct topo_walk_info *info = revs->topo_walk_info;
|
||||
struct commit *c;
|
||||
while ((c = prio_queue_peek(&info->indegree_queue)) &&
|
||||
c->generation >= gen_cutoff)
|
||||
commit_graph_generation(c) >= gen_cutoff)
|
||||
indegree_walk_step(revs);
|
||||
}
|
||||
|
||||
@ -3420,8 +3420,8 @@ static void init_topo_walk(struct rev_info *revs)
|
||||
test_flag_and_insert(&info->explore_queue, c, TOPO_WALK_EXPLORED);
|
||||
test_flag_and_insert(&info->indegree_queue, c, TOPO_WALK_INDEGREE);
|
||||
|
||||
if (c->generation < info->min_generation)
|
||||
info->min_generation = c->generation;
|
||||
if (commit_graph_generation(c) < info->min_generation)
|
||||
info->min_generation = commit_graph_generation(c);
|
||||
|
||||
*(indegree_slab_at(&info->indegree, c)) = 1;
|
||||
|
||||
@ -3479,8 +3479,8 @@ static void expand_topo_walk(struct rev_info *revs, struct commit *commit)
|
||||
if (parse_commit_gently(parent, 1) < 0)
|
||||
continue;
|
||||
|
||||
if (parent->generation < info->min_generation) {
|
||||
info->min_generation = parent->generation;
|
||||
if (commit_graph_generation(parent) < info->min_generation) {
|
||||
info->min_generation = commit_graph_generation(parent);
|
||||
compute_indegrees_to_depth(revs, info->min_generation);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user