Thread (3 messages) 3 messages, 2 authors, 2021-04-01

Re: should git maintenance prefetch be taught to honor remote.fetch refspec?

From: Tom Saeger <hidden>
Date: 2021-04-01 19:42:39

On Thu, Apr 01, 2021 at 03:07:37PM -0400, Derrick Stolee wrote:
On 4/1/2021 2:49 PM, Tom Saeger wrote:
quoted
I've recently setup git maintenance and noticed prefetch task
fetches ALL remote refs (well not tags) and does not honor
remote fetch config settings.
This is intentional. The point is to get the latest objects
without modifying any local copies of refs. You still need
to run "git fetch" manually to update the refs, but that
should be faster because you have most of the objects already
in your copy of the repository.
I get all that.

In my particular use-case - I constrained the fetch refspec to purposely
limit the number of objects and remote refs only to those of interest.

"git fetch" won't ever use the other 120 refs that got pulled in by
prefetch.

If the configured remote fetch refspecs were honored,
prefetch would only update those objects/refs which `git fetch` would
have.
Here is the essential part of the documentation [1]:

	The refmap is custom to avoid updating local or
	remote branches (those in refs/heads or refs/remotes).
	Instead, the remote refs are stored in
	refs/prefetch/<remote>/. Also, tags are not updated.

	This is done to avoid disrupting the remote-tracking
	branches. The end users expect these refs to stay
	unmoved unless they initiate a fetch. With prefetch
	task, however, the objects necessary to complete a
	later real fetch would already be obtained, so the real
	fetch would go faster. In the ideal case, it will just
	become an update to a bunch of remote-tracking branches
	without any object transfer.

[1] https://git-scm.com/docs/git-maintenance#Documentation/git-maintenance.txt-prefetch

Thanks,
-Stolee
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help