On 08/23/2017 02:37 PM, Nguyễn Thái Ngọc Duy wrote: > refs/bisect is unfortunately per-worktree, so we need to look in > per-worktree logs/refs/bisect in addition to per-repo logs/refs. The > current iterator only goes through per-repo logs/refs. > > Use merge iterator to walk two ref stores at the same time and pick > per-worktree refs from the right iterator. > > PS. Note the unsorted order of for_each_reflog in the test. This is > supposed to be OK, for now. If we enforce order on for_each_reflog() > then some more work will be required. > > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> > --- > refs/files-backend.c | 59 +++++++++++++++++++++++++++++++++---------- > t/t1407-worktree-ref-store.sh | 30 ++++++++++++++++++++++ > 2 files changed, 75 insertions(+), 14 deletions(-) > > diff --git a/refs/files-backend.c b/refs/files-backend.c > index 5cca55510b..d4d22882ef 100644 > --- a/refs/files-backend.c > +++ b/refs/files-backend.c > [...] > +static enum iterator_selection reflog_iterator_select( > + struct ref_iterator *iter_worktree, > + struct ref_iterator *iter_common, > + void *cb_data) > +{ > + if (iter_worktree) { > + /* > + * We're a bit loose here. We probably should ignore > + * common refs if they are accidentally added as > + * per-worktree refs. > + */ > + return ITER_SELECT_0; I don't understand the point of the comment. If we should ignore common refs here, why not do it rather than commenting about it? Wouldn't it be really easy to implement? OTOH if it's not needed, then why the comment? > [...] Michael