Skip to content

Commit a472302

Browse files
derrickstoleedscho
authored andcommitted
revision: create mark_trees_uninteresting_dense()
The sparse tree walk algorithm was created in d5d2e93 (revision: implement sparse algorithm, 2019-01-16) and involves using the mark_trees_uninteresting_sparse() method. This method takes a repository and an oidset of tree IDs, some of which have the UNINTERESTING flag and some of which do not. Create a method that has an equivalent set of preconditions but uses a "dense" walk (recursively visits all reachable trees, as long as they have not previously been marked UNINTERESTING). This is an important difference from mark_tree_uninteresting(), which short-circuits if the given tree has the UNINTERESTING flag. A use of this method will be added in a later change, with a condition set whether the sparse or dense approach should be used. Signed-off-by: Derrick Stolee <[email protected]>
1 parent fe02e1c commit a472302

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

revision.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,21 @@ static void add_children_by_path(struct repository *r,
220220
free_tree_buffer(tree);
221221
}
222222

223+
void mark_trees_uninteresting_dense(struct repository *r,
224+
struct oidset *trees)
225+
{
226+
struct object_id *oid;
227+
struct oidset_iter iter;
228+
229+
oidset_iter_init(trees, &iter);
230+
while ((oid = oidset_iter_next(&iter))) {
231+
struct tree *tree = lookup_tree(r, oid);
232+
233+
if (tree->object.flags & UNINTERESTING)
234+
mark_tree_contents_uninteresting(r, tree);
235+
}
236+
}
237+
223238
void mark_trees_uninteresting_sparse(struct repository *r,
224239
struct oidset *trees)
225240
{

revision.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ void put_revision_mark(const struct rev_info *revs,
487487

488488
void mark_parents_uninteresting(struct rev_info *revs, struct commit *commit);
489489
void mark_tree_uninteresting(struct repository *r, struct tree *tree);
490+
void mark_trees_uninteresting_dense(struct repository *r, struct oidset *trees);
490491
void mark_trees_uninteresting_sparse(struct repository *r, struct oidset *trees);
491492

492493
void show_object_with_name(FILE *, struct object *, const char *);

0 commit comments

Comments
 (0)