git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Improvement: `git-maintenance` to allow configuring of remotes to fetch

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 3, 2024, 16:07 UTC
Message-ID
<xmqq5xrcn2k1.fsf@gitster.g>
In-Reply-To
<ZtacHCuql0pX3V2u@tanuki>
Patrick Steinhardt <ps@pks.im> writes:
Show 9 quoted lines
> The prefetch refspec would be rewritten by git-maintenance(1) such that
> the destination part (the right-hand side of the refspec) is prefixed
> with `refs/prefetch/`, same as the fetch refspec would be changed in
> this way.
>
> An alternative would be to _not_ rewrite the prefetch refspec at all and
> thus allow the user to prefetch into arbitrary hierarchies. But I'm a
> bit worried that this might cause users to misconfigure prefetches by
> accident, causing it to overwrite their usual set of refs.

I agree that it is the right place to configure this as attributes to remotes. It would make it handy if we could give a catch-all configuration, though. For example:

 [remote "origin"]
	prefetch = true
	prefetchref = refs/heads/* refs/tags/*
 [remote "*"]
	prefetch = false

may toggle prefetch off for all remotes, except that the tags and the local branches of the remote "origin" are prefetched. Instead of a multi-value configuration variable (like remote.*.fetch) where we need to worry about clearing convention, we can use a regular "last one wins" variable that is whitespace separated patterns, as such a pattern can never have a whitespace in it.

As you too agree with the position to consider "prefetch" should be invisible to the end-users, we should not allow users to specify the full refspec at all, or if it is forced or not with "+" prefix. Only accept a set of patterns to match, and keep it opaque where in the local refs/* hierarchy they are stored. It is an implementation detail that the users should not have to know about and rely on.

Thanks.
Previous: Patrick SteinhardtNext: Shubham Kanodia
Message 8 of 10 in “Improvement: `git-maintenance` to allow configuring of remotes to fetch”
  1. Shubham KanodiaAug 26, 2024
  2. Patrick SteinhardtAug 28, 2024
  3. Junio C HamanoAug 28, 2024
  4. Shubham KanodiaSep 2, 2024
  5. Patrick SteinhardtSep 3, 2024
  6. Shubham KanodiaSep 3, 2024
  7. Patrick SteinhardtSep 3, 2024
  8. Junio C HamanoSep 3, 2024
  9. Shubham KanodiaSep 4, 2024
  10. Shubham KanodiaSep 4, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.