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, 02:33 UTC
Message-ID
<20200821023335.GA3124022@coredump.intra.peff.net>
In-Reply-To
<CA+P7+xqfAqnoKBeOiO6f7tdyi_7M=wKpmnFoWBt6UHbOqbYCzQ@mail.gmail.com>
On Thu, Aug 20, 2020 at 04:59:53PM -0700, Jacob Keller wrote:
Show 14 quoted lines
> > The relevant commit is 2467a4fa03 (Remove duplicate ref matches in
> > fetch, 2007-10-08), I think. We may end up with multiple refspecs
> > requesting a particular ref. E.g.:
> >
> >   git fetch origin refs/heads/master refs/heads/*
> >
> > I don't think the order should matter. If we apply negative refspecs
> > first, then we'd either remove both copies or leave both untouched (and
> > if the latter, then de-dup to a single). If we apply negative refspecs
> > after de-duping, then we'd either remove the single or leave it in
> > place. But the result is the same either way.
> 
> I'm not sure this is quite true in the case where destinations are
> supplied. Suppose this case:

Oh, you're right. I was too focused on the de-duping of identical refs, but this is also handling colliding destinations.

Show 12 quoted lines
> git fetch refs/heads/*:refs/remotes/origin/*
> refs/other/mybranch:refs/remotes/origin/mybranch
> 
> This would ofcourse error out due to de-duping where we determine that
> both would fetch to the same place.. however if you also added a
> negative refspec:
> 
> git fetch refs/heads/*:refs/remotes/origin/*
> refs/other/mybranch:refs/remotes/origin/mybranch ^refs/heads/mybranch
> 
> then shouldn't this work? meaning we should de-dupe only after we
> apply negative refspecs in this case?

Yes, I'd agree we should be applying the negative refspecs first, and then de-duping / looking for collisions. Which I think is what the patch is doing currently.

-Peff
Previous: Jacob KellerNext: Junio C Hamano
Message 11 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.