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

Re: [ITCH] Specify refspec without remote

From
Jeff King <peff@peff.net>
Date
Apr 10, 2013, 17:27 UTC
Message-ID
<20130410172748.GA16908@sigill.intra.peff.net>
In-Reply-To
<7v4nfenxzm.fsf@alter.siamese.dyndns.org>
On Wed, Apr 10, 2013 at 09:37:01AM -0700, Junio C Hamano wrote:
Show 15 quoted lines
> > The missing case 4 is obviously:
> >
> >   dst=missing, refs=present
> > ...
> > Do you want to explain your thinking? I'm guessing it has to do with the
> > fact that choosing branch.*.remote is about trying to push to the
> > configured upstream (even though we traditionally do _not_ take into
> > account branch.*.merge when doing so).
> 
> With the branch.$name.remote, the user tells us "When I am on this
> branch, I want to talk to this remote".  When you did
> 
> 	git push -- master next ;# case #4
> 
> on branch maint, branch.maint.remote should not come into play.
I understand that's your position, but I don't understand _why_.

If branch.$name.remote is "when I am on this branch, I want to talk to this remote", that rule is not be impacted by the presence of refspecs at all.

If it meant "when I am on this branch, and I do not specify any refspecs, then I would by default want to push this branch to that remote", then your proposed behavior would make more sense. And if you are using push.default=upstream, that is what happens.

But historically the default push has been "matching". So in your other examples:

Show 8 quoted lines
> Would we want to push our 'master' to branch.master.remote in a way 
> 
> 	git checkout master && git push
> 
> would do, while at the same time because we were told to do the same
> for 'next', we do the same as
> 
> 	git checkout next && git push

These do not have anything to do with pushing the checked-out branch in particular. The first one may very well be pushing "next" to the remote specified by branch.master.remote.

So I would argue that one of these two makes sense:
  1. branch.*.remote means "use this as the default remote on this
     branch, no matte which refs we are pushing"
  2. branch.*.remote is not respected at all for remote selection with
     "matching". It is used only when combined with branch.*.merge,
     which means that only the "upstream" mode would use it.

I advocated (1) in my previous message, but I would also be OK with (2), even though it is a change from the current behavior. But what you are suggesting seems like an inconsistent mix of the two.

Show 9 quoted lines
> would do?  That would work if you give just branch names, but that
> is not a general enough definition to cover your case #4, e.g.
> 
> 	git push -- v1.2.3 master:refs/remotes/mothership/master
> 
> If we define case #4 to push to the remote.pushdefault (falling back
> to remote.default), this case would do what can simply be expected;
> if the earlier cases also push to that same place, ignoring
> branch.$name.remote for master and next, that would be consistent.

So I think what you are getting at is that branch.*.remote is about saying "when we push X, it goes to remote Y". And with v1.2.3, we obviously cannot have such a hint, because it is not a branch. But my point is that is _not_ how it works today. So if you want consistency, we would also need to adjust how branch.*.remote interacts with "matching".

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 24 of 68 in “[ITCH] Specify refspec without remote”
  1. Ramkumar RamachandraMar 18, 2013
  2. Jeff KingMar 18, 2013
  3. Ramkumar RamachandraMar 19, 2013
  4. Jeff KingMar 19, 2013
  5. Duy NguyenMar 19, 2013
  6. Ramkumar RamachandraMar 19, 2013
  7. Duy NguyenMar 19, 2013
  8. Holger Hellmuth (IKS)Mar 19, 2013
  9. Holger Hellmuth (IKS)Mar 19, 2013
  10. Junio C HamanoMar 19, 2013
  11. Junio C HamanoMar 19, 2013
  12. Ramkumar RamachandraApr 9, 2013
  13. Junio C HamanoApr 9, 2013
  14. Ramkumar RamachandraApr 9, 2013
  15. Junio C HamanoApr 9, 2013
  16. Ramkumar RamachandraApr 9, 2013
  17. Ramkumar RamachandraApr 9, 2013
  18. Junio C HamanoApr 9, 2013
  19. Jonathan NiederApr 9, 2013
  20. Jonathan NiederApr 9, 2013
  21. Junio C HamanoApr 10, 2013
  22. Jeff KingApr 10, 2013
  23. Junio C HamanoApr 10, 2013
  24. Jeff KingApr 10, 2013
  25. Junio C HamanoApr 10, 2013
  26. Jeff KingApr 10, 2013
  27. Ramkumar RamachandraApr 10, 2013
  28. Ramkumar RamachandraApr 10, 2013
  29. Jeff KingApr 10, 2013
  30. Ramkumar RamachandraApr 10, 2013
  31. Jeff KingApr 10, 2013
  32. Ramkumar RamachandraApr 10, 2013
  33. Ramkumar RamachandraApr 10, 2013
  34. Ramkumar RamachandraApr 10, 2013
  35. Junio C HamanoApr 10, 2013
  36. Ramkumar RamachandraApr 10, 2013
  37. Jonathan NiederApr 10, 2013
  38. Jeff KingApr 10, 2013
  39. Jonathan NiederApr 10, 2013
  40. Jeff KingApr 10, 2013
  41. Ramkumar RamachandraApr 10, 2013
  42. Jeff KingApr 10, 2013
  43. Ramkumar RamachandraApr 10, 2013
  44. Jeff KingApr 10, 2013
  45. Ramkumar RamachandraApr 10, 2013
  46. Jonathan NiederApr 10, 2013
  47. Ramkumar RamachandraApr 10, 2013
  48. Jonathan NiederApr 10, 2013
  49. Ramkumar RamachandraApr 10, 2013
  50. Jeff KingApr 10, 2013
  51. Ramkumar RamachandraApr 10, 2013
  52. Jeff KingApr 10, 2013
  53. Ramkumar RamachandraApr 10, 2013
  54. Jeff KingApr 10, 2013
  55. Ramkumar RamachandraApr 10, 2013
  56. Ramkumar RamachandraApr 11, 2013
  57. Ramkumar RamachandraApr 11, 2013
  58. Junio C HamanoApr 11, 2013
  59. Ramkumar RamachandraApr 13, 2013
  60. Junio C HamanoApr 10, 2013
  61. Ramkumar RamachandraApr 10, 2013
  62. Junio C HamanoApr 12, 2013
  63. Jeff KingApr 10, 2013
  64. Ramkumar RamachandraApr 10, 2013
  65. Jeff KingApr 10, 2013
  66. Junio C HamanoApr 10, 2013
  67. Jeff KingApr 10, 2013
  68. Ramkumar RamachandraApr 10, 2013

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.