[PATCH v5 1/3] ref-filter: add worktreepath atom

2019-01-05 Thread nbelakovski
From: Nickolai Belakovski Add an atom providing the path of the linked worktree where this ref is checked out, if it is checked out in any linked worktrees, and empty string otherwise. --- Documentation/git-for-each-ref.txt | 5 +++ ref-filter.c | 71 ++

Re: [PATCH v5 1/3] ref-filter: add worktreepath atom

2019-01-18 Thread Nickolai Belakovski
On Mon, Jan 7, 2019 at 10:20 AM Junio C Hamano wrote: > When seeing a tag or note ref, by definition that's not something we > can have checked out in any worktree. I wonder if it is worth to > optimize further by omitting this lookup when ref is not a local > branch? > > IOW, with a typical numb

Re: [PATCH v5 1/3] ref-filter: add worktreepath atom

2019-01-18 Thread Nickolai Belakovski
On Fri, Jan 18, 2019 at 2:17 PM Nickolai Belakovski wrote: > > > I think avoiding this would be check, we can simply check ref->kind == > FILTER_REFS_BRANCHES ahead of calling into get_worktree_path and > provide an empty string otherwise. > *would be check -> would be cheap

Re: [PATCH v5 1/3] ref-filter: add worktreepath atom

2019-01-07 Thread Junio C Hamano
nbelakov...@gmail.com writes: > +static struct hashmap ref_to_worktree_map; > +static struct worktree **worktrees = NULL; > + > /* > * An atom is a valid field atom listed below, possibly prefixed with > * a "*" to denote deref_tag(). > @@ -420,6 +438,34 @@ static int head_atom_parser(const s