Skip to content

Commit 10103da

Browse files
committed
commit-reach: add general graph traversal find_reachable()
Add find_reachable(), a generalization of the memoized DFS in can_all_from_reach_with_flag(). The benefits are two-fold: 1. make the code more uniform - fewer core graph traversals to maintain and reason about. 2. optimization for ref-filter --contains Most converted callers get equal or slightly better performance, since this standardizes on the generally "best" implementation. The big win is ref-filter --contains/--no-contains. Instead of calling commit_contains() for each ref, we batch it into batched calls to find_reachable(), changing the time complexity from O(N * D) to O(D + N) where D is the reachable graph depth and N is the number of refs. Signed-off-by: Kristofer Karlsson <krka@spotify.com>
1 parent 9ac3f19 commit 10103da

6 files changed

Lines changed: 236 additions & 288 deletions

File tree

builtin/tag.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting,
7171

7272
if (verify_ref_format(format))
7373
die(_("unable to parse format string"));
74-
filter->with_commit_tag_algo = 1;
7574
filter_and_format_refs(filter, FILTER_REFS_TAGS, sorting, format);
7675

7776
free(to_free);

0 commit comments

Comments
 (0)