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

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

From
Derrick Stolee <stolee@gmail.com>
Date
Apr 4, 2021, 20:25 UTC
Message-ID
<f113284b-a7fe-ba7f-ce1c-d214efd5d0c6@gmail.com>
In-Reply-To
<xmqq1rbs4c6t.fsf@gitster.g>
On 4/2/2021 5:19 PM, Junio C Hamano wrote:
Show 31 quoted lines
> Derrick Stolee <stolee@gmail.com> writes:
> 
>> The other issue is that exact matches (no "*") have an exact
>> string in the destination, too, so replacing the _entire_
>> destination with "refs/prefetch/<remote>/*" breaks the refspec.
>> I think the substring approach will still work here.
> 
> I wonder if that matters.  If the exact format says
> 
> 	[remote "origin"]
> 	        url = git://git.kernel.org/pub/scm/git/git.git/
> 		fetch = +refs/heads/todo:refs/x/y/z
> 
> you can just add refs/prefetch/<remote>/ to the entire RHS to ensure
> that (1) the prefetch would not affect anything outside the 'prefetch'
> to break @{upstream} and friends, and (2) the prefetch from this remote
> would not affect anything used for other remotes.
> 
> IOW, the RHS, as long as it is hidden from normal operations and
> does not conflict with interaction with other repositories, where
> exactly in the refs hierarchy these objects are "parked" does not
> matter, I would think.
> 
> I do not recommend unparsed refspec and textually munging, by the
> way.  Doesn't
> 
> 	git fetch master:remotes/origin/master
> 
> first parse to normalize the src/dst sides to turn it into
> 
> 	git fetch refs/heads/master:refs/remotes/origin/master

I do not see evidence of this being reflected in my testing. The good news is that I'm creating a test scenario that will give us a clear way to test what the refspec parsing (and new output format logic) is doing.

Now, it might be that we are having an equivalent behavior to what you are suggesting because of the way refs are interpreted when those refs are created based on the refspec. This complicates things slightly, and I can work to see if there is a good way to modify the refspec parsing to make this an explicit assumption.

Show 5 quoted lines
> which is what you want to further redirect to the prefetch hierarchy
> 
> 	git fetch +refs/heads/master:refs/prefetch/origin/refs/remotes/origin/master
> 
> or whatever munging scheme is used?

The replacement will use the existing refspec's patterns for partitioning the refspace, except we add 'prefetch' and no longer insert the remote name ourselves. This allows us to have shorter refnames while respecting the given layout as much as possible.

> Also, I wonder if there should be a mechanism to prune the
> prefetched refs, but that is totally outside the scope of the
> problem we have been discussing in this thread.
 
Yes, this is a good idea. Prefetch refs are going to add the
"force" option (starts with '+') because these refs should be
updated automatically when the remote refs are force-pushed.
Having a mechanism for removing dropped refs is a good idea.

Thanks, -Stolee

Previous: Tom SaegerNext: Junio C Hamano
Message 16 of 27 in “should git maintenance prefetch be taught to honor remote.fetch refspec?”
  1. Tom SaegerApr 1, 2021
  2. Derrick StoleeApr 1, 2021
  3. Tom SaegerApr 1, 2021
  4. Junio C HamanoApr 1, 2021
  5. Tom SaegerApr 1, 2021
  6. Derrick StoleeApr 1, 2021
  7. Tom SaegerApr 2, 2021
  8. Derrick StoleeApr 2, 2021
  9. Derrick StoleeApr 2, 2021
  10. Tom SaegerApr 2, 2021
  11. Junio C HamanoApr 2, 2021
  12. Tom SaegerApr 2, 2021
  13. Tom SaegerApr 2, 2021
  14. Junio C HamanoApr 2, 2021
  15. Tom SaegerApr 2, 2021
  16. Derrick StoleeApr 4, 2021
  17. Junio C HamanoApr 4, 2021
  18. Derrick StoleeApr 5, 2021
  19. Junio C HamanoApr 5, 2021
  20. Tom SaegerApr 5, 2021
  21. Junio C HamanoApr 5, 2021
  22. Derrick StoleeApr 5, 2021
  23. Tom SaegerApr 5, 2021
  24. Derrick StoleeApr 5, 2021
  25. Eric SunshineApr 2, 2021
  26. Tom SaegerApr 3, 2021
  27. Derrick StoleeApr 3, 2021

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.