path: root/builtin/tag.c
diff options
authorKarthik Nayak <>2015-10-18 10:25:04 (GMT)
committerJunio C Hamano <>2015-10-18 23:07:36 (GMT)
commit008ed7df93082103c8c74d045e573e19868b2c6b (patch)
treea5b16f7e071f8566f39f23e072760bbc50e5d1cc /builtin/tag.c
parent5242860f548d1869ac2779726ad496f0ae8ab5ca (diff)
tag.c: use the correct algorithm for the '--contains' option
In b7cc53e9 (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 <> Tested-by: Jerry Snitselaar <> Signed-off-by: Karthik Nayak <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/tag.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/tag.c b/builtin/tag.c
index b2e4ddc..42554d8 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -52,6 +52,7 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting, con
+ filter->with_commit_tag_algo = 1;
filter_refs(&array, filter, FILTER_REFS_TAGS);
ref_array_sort(sorting, &array);