Re: [PATCH 05/23] refs_ref_iterator_begin(): don't check prefixes redundantly
- Date: Wed, 17 May 2017 16:21:30 +0200
- From: Michael Haggerty <mhagger@xxxxxxxxxxxx>
- Subject: Re: [PATCH 05/23] refs_ref_iterator_begin(): don't check prefixes redundantly
On 05/17/2017 02:59 PM, Jeff King wrote:
> On Wed, May 17, 2017 at 02:05:28PM +0200, Michael Haggerty wrote:
>> The backend already takes care of 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.
> Hmm. So givne a refname like "refs/heads/foo" and a prefix like
> "refs/heads/", would we trim down to "foo" and then further try to
> remove "refs/heads" again?
No, the prefix is used to choose which references to let through and the
trim value is then used to munge the refname. They are orthogonal,
though AFAIK the trim value is always set to 0 or to strlen(prefix).
`refs->be->iterator_begin()` only has the `prefix` feature; it doesn't
trim anything. So we can rely on it to discard the references that
aren't in `prefix`. All we need the `prefix_ref_iterator` for is the