# [PATCH] tag.c: use the correct algorithm for the '--contains' option

1 messages from 2015-10-17 to 2015-10-17. Participants: Karthik Nayak.
Thread: https://gitlist.dev/t/40580

## Karthik Nayak, 2015-10-17 18:23

Subject: [PATCH] tag.c: use the correct algorithm for the '--contains' option
Message-ID: <1445106224-21013-1-git-send-email-Karthik.188@gmail.com>
URL: https://gitlist.dev/e/1445106224-21013-1-git-send-email-Karthik.188%40gmail.com
In-Reply-To: <AOLa=ZSjNjey3zWozFkyFw-X-BPtsVNpQKqG5hO9-7qJOBR_KA@mail.gmail.com>

```
In b7cc53e92c806b73e14b03f60c17b7c29e52b4a4 we port tag.c to use
ref-filter APIs for filtering and printing refs. But that commit
missed out on setting 'filter->with_commit_tag_algo' which would
ensure the correct algorithm is used for the '--contains' option.
As reported by Jerry Snitselaar, this causes the 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: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Tested-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
 builtin/tag.c | 1 +
 1 file changed, 1 insertion(+)

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

```
