Re: RFC: New reference iteration paradigm

2018-05-29 Thread Jeff King
On Sat, May 26, 2018 at 07:25:32PM +0200, Jakub Narebski wrote: > > At one point I wrote a patch to binary search the packed-refs file, find > > the first "refs/tags/" entry, and then walk linearly through there. What > > stopped me is that the current refs.c code (I guess file-backend.c these >

Re: RFC: New reference iteration paradigm

2018-05-26 Thread Jakub Narebski
Jeff King writes: > On Thu, Mar 31, 2016 at 11:01:44AM -0700, Junio C Hamano wrote: >> Michael Haggerty writes: >> >>> the backend now has to implement >>> struct ref_iterator *ref_iterator_begin_fn(const char *submodule,

Re: RFC: New reference iteration paradigm

2016-03-31 Thread David Turner
On Thu, 2016-03-31 at 18:13 +0200, Michael Haggerty wrote: > Currently the way to iterate over references is via a family of > for_each_ref()-style functions. You pass some arguments plus a > callback > function and cb_data to the function, and your callback is called for > each reference that is

Re: RFC: New reference iteration paradigm

2016-03-31 Thread Junio C Hamano
Jeff King writes: > On Thu, Mar 31, 2016 at 11:01:44AM -0700, Junio C Hamano wrote: > >> Michael Haggerty writes: >> >> > the backend now has to implement >> > >> >> struct ref_iterator *ref_iterator_begin_fn(const char *submodule, >> >>

Re: RFC: New reference iteration paradigm

2016-03-31 Thread Jeff King
On Thu, Mar 31, 2016 at 11:01:44AM -0700, Junio C Hamano wrote: > Michael Haggerty writes: > > > the backend now has to implement > > > >> struct ref_iterator *ref_iterator_begin_fn(const char *submodule, > >>const char *prefix,

Re: RFC: New reference iteration paradigm

2016-03-31 Thread Junio C Hamano
Michael Haggerty writes: > the backend now has to implement > >> struct ref_iterator *ref_iterator_begin_fn(const char *submodule, >>const char *prefix, >>unsigned int flags); > > The

RFC: New reference iteration paradigm

2016-03-31 Thread Michael Haggerty
Currently the way to iterate over references is via a family of for_each_ref()-style functions. You pass some arguments plus a callback function and cb_data to the function, and your callback is called for each reference that is selected. This works, but it has two big disadvantages: 1. It is