threads / patch / 40580

patchtag.c: use the correct algorithm for the '--contains' option

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

## tl;dr

One message between Oct 17, 2015 and Oct 17, 2015. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Karthik Nayak· Oct 17, 2015, 18:23 UTC · lore

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(+)
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

← back to recent threads