From: Michael Haggerty Date: Mon, 22 May 2017 14:17:36 +0000 (+0200) Subject: refs_ref_iterator_begin(): don't check prefixes redundantly X-Git-Tag: v2.14.0-rc0~109^2~19 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/c7599718167de62c437490e9ea300eeb9284a572 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 Signed-off-by: Junio C Hamano --- diff --git a/refs.c b/refs.c index 8af9641aa1..8494b1f20d 100644 --- a/refs.c +++ b/refs.c @@ -1247,7 +1247,13 @@ struct ref_iterator *refs_ref_iterator_begin( struct ref_iterator *iter; iter = refs->be->iterator_begin(refs, prefix, flags); - iter = prefix_ref_iterator_begin(iter, prefix, trim); + + /* + * `iterator_begin()` already takes care of prefix, but we + * might need to do some trimming: + */ + if (trim) + iter = prefix_ref_iterator_begin(iter, "", trim); return iter; }