In b7cc53e92c806b73e14b03f60c17b7c29e52b4a4 we port tag.c to use 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. Maybe we'd want to unify these eventually.
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 the '--contains' option 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 <matthieu.moy@grenoble-inp.fr> Tested-by: Jerry Snitselaar <jsnitsel@redhat.com> Signed-off-by: Karthik Nayak <karthik.188@gmail.com> --- builtin/tag.c | 1 + 1 file changed, 1 insertion(+)
Show changes to builtin/tag.c +1 −0
diff --git a/builtin/tag.c b/builtin/tag.c index 977a18c..2c5a9f1 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -49,6 +49,7 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting) format = "%(refname:short)"; verify_ref_format(format); + filter->with_commit_tag_algo = 1; filter_refs(&array, filter, FILTER_REFS_TAGS); ref_array_sort(sorting, &array);
-- 2.6.1