Skip to content

Commit 008ed7d

Browse files
KarthikNayakgitster
authored andcommitted
tag.c: use the correct algorithm for the '--contains' option
In b7cc53e (tag.c: use 'ref-filter' APIs, 2015-09-11) we port tag.c to use the ref-filter APIs for filtering and printing refs. In ref-filter we have two implementations for filtering refs when the '--contains' option is used. Although they do the same thing, one is optimized for filtering branches and the other for tags (borrowed from branch.c and tag.c respectively) and the 'filter->with_commit_tag_algo' bit decides which algorithm must be used. We should unify these. When we ported tag.c to use ref-filter APIs we missed out on setting the 'filter->with_commit_tag_algo' bit. As reported by Jerry Snitselaar, this causes "git tag --contains" to work way slower than expected, fix this by setting 'filter->with_commit_tag_algo' in tag.c before calling 'filter_refs()'. Mentored-by: Matthieu Moy <[email protected]> Tested-by: Jerry Snitselaar <[email protected]> Signed-off-by: Karthik Nayak <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5242860 commit 008ed7d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

builtin/tag.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting, con
5252
}
5353

5454
verify_ref_format(format);
55+
filter->with_commit_tag_algo = 1;
5556
filter_refs(&array, filter, FILTER_REFS_TAGS);
5657
ref_array_sort(sorting, &array);
5758

0 commit comments

Comments
 (0)