{"thread":{"id":"40583","subject":"[PATCH v2] tag.c: use the correct algorithm for the '--contains' option","startedAt":"2015-10-18T10:25:04Z","lastAt":"2015-10-18T10:25:04Z","messageCount":1,"participants":["Karthik Nayak"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"271868","messageId":"1445163904-24611-1-git-send-email-Karthik.188@gmail.com","threadId":"40583","inReplyTo":null,"subject":"[PATCH v2] tag.c: use the correct algorithm for the '--contains' option","fromName":"Karthik Nayak","fromEmail":"karthik.188@gmail.com","sentAt":"2015-10-18T10:25:04Z","receivedAt":"2015-10-18T10:25:04Z","isPatch":true,"sender":{"key":"karthik.188@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1786334?v=4"},"body":"In b7cc53e92c806b73e14b03f60c17b7c29e52b4a4 we port tag.c to use\nref-filter APIs for filtering and printing refs. In ref-filter we have\ntwo implementations for filtering refs when the '--contains' option is\nused. Although they do the same thing, one is optimized for filtering\nbranches and the other for tags (borrowed from branch.c and tag.c\nrespectively) and the 'filter->with_commit_tag_algo' bit decides which\nalgorithm must be used. Maybe we'd want to unify these eventually.\n\nWhen we ported tag.c to use ref-filter APIs we missed out on setting\nthe 'filter->with_commit_tag_algo' bit.  As reported by Jerry\nSnitselaar, this causes the '--contains' option to work way slower\nthan expected, fix this by setting 'filter->with_commit_tag_algo' in\ntag.c before calling 'filter_refs()'.\n\nMentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>\nTested-by: Jerry Snitselaar <jsnitsel@redhat.com>\nSigned-off-by: Karthik Nayak <karthik.188@gmail.com>\n---\n builtin/tag.c | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex 977a18c..2c5a9f1 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -49,6 +49,7 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting)\n \t\tformat = \"%(refname:short)\";\n \n \tverify_ref_format(format);\n+\tfilter->with_commit_tag_algo = 1;\n \tfilter_refs(&array, filter, FILTER_REFS_TAGS);\n \tref_array_sort(sorting, &array);\n \n-- \n2.6.1\n"}]}