Merge branch 'jk/bitmap-tree-optim'
Avoid duplicated work while building reachability bitmaps. * jk/bitmap-tree-optim: bitmaps: don't recurse into trees already in the bitmap
This commit is contained in:
commit
1ef488eaaa
@ -164,6 +164,9 @@ static void process_tree(struct traversal_context *ctx,
|
|||||||
die("bad tree object");
|
die("bad tree object");
|
||||||
if (obj->flags & (UNINTERESTING | SEEN))
|
if (obj->flags & (UNINTERESTING | SEEN))
|
||||||
return;
|
return;
|
||||||
|
if (revs->include_check_obj &&
|
||||||
|
!revs->include_check_obj(&tree->object, revs->include_check_data))
|
||||||
|
return;
|
||||||
|
|
||||||
failed_parse = parse_tree_gently(tree, 1);
|
failed_parse = parse_tree_gently(tree, 1);
|
||||||
if (failed_parse) {
|
if (failed_parse) {
|
||||||
|
@ -525,6 +525,22 @@ static int should_include(struct commit *commit, void *_data)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int should_include_obj(struct object *obj, void *_data)
|
||||||
|
{
|
||||||
|
struct include_data *data = _data;
|
||||||
|
int bitmap_pos;
|
||||||
|
|
||||||
|
bitmap_pos = bitmap_position(data->bitmap_git, &obj->oid);
|
||||||
|
if (bitmap_pos < 0)
|
||||||
|
return 1;
|
||||||
|
if ((data->seen && bitmap_get(data->seen, bitmap_pos)) ||
|
||||||
|
bitmap_get(data->base, bitmap_pos)) {
|
||||||
|
obj->flags |= SEEN;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int add_commit_to_bitmap(struct bitmap_index *bitmap_git,
|
static int add_commit_to_bitmap(struct bitmap_index *bitmap_git,
|
||||||
struct bitmap **base,
|
struct bitmap **base,
|
||||||
struct commit *commit)
|
struct commit *commit)
|
||||||
@ -620,6 +636,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
|
|||||||
incdata.seen = seen;
|
incdata.seen = seen;
|
||||||
|
|
||||||
revs->include_check = should_include;
|
revs->include_check = should_include;
|
||||||
|
revs->include_check_obj = should_include_obj;
|
||||||
revs->include_check_data = &incdata;
|
revs->include_check_data = &incdata;
|
||||||
|
|
||||||
if (prepare_revision_walk(revs))
|
if (prepare_revision_walk(revs))
|
||||||
@ -633,6 +650,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
|
|||||||
&show_data, NULL);
|
&show_data, NULL);
|
||||||
|
|
||||||
revs->include_check = NULL;
|
revs->include_check = NULL;
|
||||||
|
revs->include_check_obj = NULL;
|
||||||
revs->include_check_data = NULL;
|
revs->include_check_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +262,7 @@ struct rev_info {
|
|||||||
int min_parents;
|
int min_parents;
|
||||||
int max_parents;
|
int max_parents;
|
||||||
int (*include_check)(struct commit *, void *);
|
int (*include_check)(struct commit *, void *);
|
||||||
|
int (*include_check_obj)(struct object *obj, void *);
|
||||||
void *include_check_data;
|
void *include_check_data;
|
||||||
|
|
||||||
/* diff info for patches and for paths limiting */
|
/* diff info for patches and for paths limiting */
|
||||||
|
Loading…
Reference in New Issue
Block a user