@@ -658,7 +658,7 @@ static void bisect_common(struct rev_info *revs)
if (prepare_revision_walk(revs))
die("revision walk setup failed");
if (revs->tree_objects)
- mark_edges_uninteresting(revs, NULL, 0);
+ mark_edges_uninteresting(revs, NULL);
}
static void exit_if_skipped_commits(struct commit_list *tried,
@@ -3136,9 +3136,10 @@ static void get_object_list(int ac, const char **av)
if (use_delta_islands)
load_delta_islands(the_repository);
+ revs.sparse_tree_walk = !!sparse;
if (prepare_revision_walk(&revs))
die(_("revision walk setup failed"));
- mark_edges_uninteresting(&revs, show_edge, sparse);
+ mark_edges_uninteresting(&revs, show_edge);
if (!fn_show_object)
fn_show_object = show_object;
@@ -548,7 +548,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
if (prepare_revision_walk(&revs))
die("revision walk setup failed");
if (revs.tree_objects)
- mark_edges_uninteresting(&revs, show_edge, 0);
+ mark_edges_uninteresting(&revs, show_edge);
if (bisect_list) {
int reaches, all;
@@ -1934,7 +1934,7 @@ int cmd_main(int argc, const char **argv)
pushing = 0;
if (prepare_revision_walk(&revs))
die("revision walk setup failed");
- mark_edges_uninteresting(&revs, NULL, 0);
+ mark_edges_uninteresting(&revs, NULL);
objects_to_send = get_delta(&revs, ref_lock);
finish_all_active_slots();
@@ -264,13 +264,12 @@ static void add_edge_parents(struct commit *commit,
}
void mark_edges_uninteresting(struct rev_info *revs,
- show_edge_fn show_edge,
- int sparse)
+ show_edge_fn show_edge)
{
struct commit_list *list;
int i;
- if (sparse) {
+ if (revs->sparse_tree_walk) {
struct oidset set;
oidset_init(&set, 16);
@@ -11,8 +11,7 @@ void traverse_commit_list(struct rev_info *, show_commit_fn, show_object_fn, voi
typedef void (*show_edge_fn)(struct commit *);
void mark_edges_uninteresting(struct rev_info *revs,
- show_edge_fn show_edge,
- int sparse);
+ show_edge_fn show_edge);
struct oidset;
struct list_objects_filter_options;
@@ -458,7 +458,8 @@ static struct commit *handle_commit(struct rev_info *revs,
if (!revs->tree_objects)
return NULL;
if (flags & UNINTERESTING) {
- mark_tree_contents_uninteresting(revs->repo, tree);
+ if (!revs->sparse_tree_walk)
+ mark_tree_contents_uninteresting(revs->repo, tree);
return NULL;
}
add_pending_object_with_path(revs, object, name, mode, path);
@@ -145,6 +145,7 @@ struct rev_info {
first_parent_only:1,
line_level_traverse:1,
tree_blobs_in_commit_order:1,
+ sparse_tree_walk:1,
/*
* Blobs are shown without regard for their existence.
Add another bit flag to the struct rev_info. The only caller that uses this after this patch is builtin/pack-objects. Without this, sparsity seems to do little good therein, as prepare_revision_walk will densely propagate UNINTERESTING flags from trees to tree contents, before mark_edges_uninteresting has a chance to be faster by being sparse. While here, drop the "sparse" parameter to mark_edges_uninteresting, introduced in 4f6d26b167 ("list-objects: consume sparse tree walk", 2019-01-16) which can now use the flag in struct rev_info. No functional change intended. Signed-off-by: Nathaniel Filardo <nwf20@cl.cam.ac.uk> --- bisect.c | 2 +- builtin/pack-objects.c | 3 ++- builtin/rev-list.c | 2 +- http-push.c | 2 +- list-objects.c | 5 ++--- list-objects.h | 3 +-- revision.c | 3 ++- revision.h | 1 + 8 files changed, 11 insertions(+), 10 deletions(-)