refs_ref_iterator_begin(): don't check prefixes redundantly
The backend already correctly restricts its output to references whose names start with the prefix. By passing the prefix again to `prefix_ref_iterator`, we were forcing that iterator to do redundant prefix comparisons. So set it to the empty string. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
May 22, 2017 at 16:17 UTC
c7599718167de62c437490e9ea300eeb9284a572
1 file changed
+7
-1
refs.c
+7
-1
@@ -1247,7 +1247,13 @@ struct ref_iterator *refs_ref_iterator_begin(
1247
struct ref_iterator *iter;
1248
1249
iter = refs->be->iterator_begin(refs, prefix, flags);
1250
- iter = prefix_ref_iterator_begin(iter, prefix, trim);
1250
+
1251
+ /*
1252
+ * `iterator_begin()` already takes care of prefix, but we
1253
+ * might need to do some trimming:
1254
+ */
1255
+ if (trim)
1256
+ iter = prefix_ref_iterator_begin(iter, "", trim);
1257
1258
return iter;
1259
}