Re: [PATCH v4] remote: allow specifying refs to prefetch
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Nov 6, 2024, 11:04 UTC
- Message-ID
- <43dd8960-4438-402e-ad45-973565a6860e@gmail.com>
- In-Reply-To
- <ZysQvUyxgdRqjvj2@pks.im>
On 06/11/2024 06:46, Patrick Steinhardt wrote:
Show 32 quoted lines
> On Tue, Nov 05, 2024 at 09:56:52PM +0530, Shubham Kanodia wrote: >> >> Let me add context here based on a few things that have already been discussed >> as a part of this thread or an earlier discussion on >> https://lore.kernel.org/git/CAG=Um+1wTbXn_RN+LOCrpZpSNR_QF582PszxNyhz5anVHtBp+w@mail.gmail.com/ >> >>> I'm coming rather late to the party and simply want to review this so >>> that the thread gets revived. So my context may be lacking, please >>> forgive me if I am reopening things that were already discussed. >> >> I don't have a particular preference here, and this was discussed in >> an earlier thread >> where Junio opined (https://lore.kernel.org/git/xmqq5xrcn2k1.fsf@gitster.g/— > > Fair enough, thanks for the pointer! The reason stated by Junio is that > having a space-separated list of refspecs makes it easier to reset the > refspec again, as we can simply use a "last-one-wins" pattern. And while > I understand that, I would claim that we already have a properly > established way to reset multi-valued lists by first assigning an empty > value: > > [remote "origin"] > prefetchref = refs/heads/* > prefetchref = refs/tags/* > prefetchref = > prefetchref = refs/heads/* > > The final value would be only "refs/heads/*" due to the reset. > > So overall I'm still leaning into the direction of making this a > multi-valued list for the sake of consistency with other refspec > configs. @Junio Let me know in case you disagree though.
It is also easier to manipulate the list with "git config" when it is multivalued as one can add values and "git config --add" and remove specific entries with "git config --unset <key> <pattern>". With a single entry to append a new value one has to resort to something like
git config <key> "$(echo $(git config <key>) <new-value>)"
which is not very user friendly. Deleting a value is even less friendly.
Best Wishes
Phillip