Re: [PATCH] remote: introduce config to set prefetch refs
- From
Shubham Kanodia <shubham.kanodia10@gmail.com>
- Date
- Sep 15, 2024, 14:06 UTC
- Message-ID
- <CAG=Um+2DiQswQr86zhT3_quO3eYH8EBpwVNQir_SvMWwAsPk5g@mail.gmail.com>
- In-Reply-To
- <xmqqo74qro6f.fsf@gitster.g>
On Sun, Sep 15, 2024 at 1:41 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 33 quoted lines
> > Shubham Kanodia <shubham.kanodia10@gmail.com> writes: > > > If we're trying to determine if a pattern > > (remote.<remote>.prefetchref) is a subset of another or not > > (remote.<remote>.fetch) (to not accidentally expand the scope beyond > > `fetch`), > > we'd need a function that does that pattern-to-pattern. Are you aware > > of any existing functions that do so? > > There is no such computation for this application. Such a > computation might become needed if you wanted to complain that the > user gave .prefetchref pattern that would never match what .fetch > patterns would allow to pass. But there is no such need. > > You will first get the advertised refs from the remote. > > Existing logic filteres them down to what matches configured > remote.$name.fetch variable. filter_prefetch_refspec() may further > reduces the result by removing those whose .src side begins with > "refs/tags/". > > Now you only look at what survived the above existing filtering, and > further narrow it down by picking only ones that match the prefetch > condition. If the refspec that survived the filtering by the fetch > refspec (and existing logic in filter_prefetch_refspec()) does not > satisfy the prefetch condition, it won't be prefetched. > > Since you are using .prefetch ONLY TO narrow the result down, by > definition, you are not adding anything what .fetch configuration > would not have fetched. > >
Ah I see — I assumed you expected all filtering for `prefetch` (existing & new) to happen inside `filter_prefetch_refspec`. But that threw me off, because `filter_prefetch_refspec` doesn't deal with advertised refs from remote, and only patterns.
Let me know if the diff in the following mail is closer to what you were expecting?