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

Re: [RFC 3/3] refspec: add support for negative refspecs

From
Jeff King <peff@peff.net>
Date
Aug 21, 2020, 18:59 UTC
Message-ID
<20200821185955.GA1165@coredump.intra.peff.net>
In-Reply-To
<CA+P7+xo8KqGnKRmF7dGhWYV9tQ7dwzjoyezGMEbh4mxKHQJUbg@mail.gmail.com>
On Fri, Aug 21, 2020 at 11:21:19AM -0700, Jacob Keller wrote:
Show 8 quoted lines
> > I also tried adding a test for fetch --prune, but that ultimately
> > calls query_refspecs_multiple and query_refspecs. I need to figure out
> > how negative refspecs need to interact with that function still.
> 
> So there's an interesting problem here... query_refspecs_multiple
> takes only the destination name, which makes the "get_stale_heads" not
> work properly, since for fetch we want to apply the refspec to the
> remote sides "source".

Hmm. So if I understand it, that function is asking about _local_ refs, and wondering "if we were to fetch using these refspecs, would we write to this ref". We know that negative refspecs can't impact the mapping of remote to local.

But I guess the case you are about is:
  git fetch --prune refs/heads/*:refs/remotes/origin/* ^refs/heads/foo

where we need to realize that the local refs/remotes/origin/foo needs to be saved. I think that should be possible by reverse-applying the transformations from any positive refspecs, and then seeing if they match any negative ones. I don't know how much support the existing code will give you for that, though.

-Peff
Previous: Jacob KellerNext: Junio C Hamano
Message 17 of 20 in “[RFC 1/3] refspec: fix documentation referring to refspec_item”
  1. Jacob KellerAug 15, 2020
  2. 2/3 refspec: make sure stack refspec_item variables are zeroedJacob Keller, Aug 15, 2020
  3. Junio C HamanoAug 17, 2020
  4. Jacob KellerAug 17, 2020
  5. 3/3 refspec: add support for negative refspecsJacob Keller, Aug 15, 2020
  6. Jacob KellerAug 17, 2020
  7. Junio C HamanoAug 17, 2020
  8. Jacob KellerAug 18, 2020
  9. Jeff KingAug 18, 2020
  10. Jacob KellerAug 20, 2020
  11. Jeff KingAug 21, 2020
  12. Junio C HamanoAug 21, 2020
  13. Jacob KellerAug 21, 2020
  14. Jacob KellerAug 21, 2020
  15. Jacob KellerAug 21, 2020
  16. Jacob KellerAug 21, 2020
  17. Jeff KingAug 21, 2020
  18. Junio C HamanoAug 17, 2020
  19. Jacob KellerAug 21, 2020
  20. Junio C HamanoAug 21, 2020

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.