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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
Tested-by: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>
Signed-off-by: Karthik Nayak <karthik.188@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]