Merge branch 'mh/clear-topo-walk-upon-reset'

The revision walking machinery uses resources like per-object flag
bits that need to be reset before a new iteration of walking
begins, but the resources related to topological walk were not
cleared correctly, which has been corrected.

* mh/clear-topo-walk-upon-reset:
  revision: free topo_walk_info before creating a new one in init_topo_walk
  revision: clear the topo-walk flags in reset_revision_walk
This commit is contained in:
Junio C Hamano 2019-12-05 12:52:48 -08:00
commit fd952307ec

View file

@ -3098,7 +3098,7 @@ static void set_children(struct rev_info *revs)
void reset_revision_walk(void)
{
clear_object_flags(SEEN | ADDED | SHOWN);
clear_object_flags(SEEN | ADDED | SHOWN | TOPO_WALK_EXPLORED | TOPO_WALK_INDEGREE);
}
static int mark_uninteresting(const struct object_id *oid,
@ -3211,10 +3211,26 @@ static void compute_indegrees_to_depth(struct rev_info *revs,
indegree_walk_step(revs);
}
static void reset_topo_walk(struct rev_info *revs)
{
struct topo_walk_info *info = revs->topo_walk_info;
clear_prio_queue(&info->explore_queue);
clear_prio_queue(&info->indegree_queue);
clear_prio_queue(&info->topo_queue);
clear_indegree_slab(&info->indegree);
clear_author_date_slab(&info->author_date);
FREE_AND_NULL(revs->topo_walk_info);
}
static void init_topo_walk(struct rev_info *revs)
{
struct topo_walk_info *info;
struct commit_list *list;
if (revs->topo_walk_info)
reset_topo_walk(revs);
revs->topo_walk_info = xmalloc(sizeof(struct topo_walk_info));
info = revs->topo_walk_info;
memset(info, 0, sizeof(struct topo_walk_info));