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, 04:13 UTC
Message-ID
<20130410041343.GB795@sigill.intra.peff.net>
In-Reply-To
<7vobdnnpx6.fsf@alter.siamese.dyndns.org>
On Tue, Apr 09, 2013 at 06:19:01PM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> > 	git push -- master next; # push two refs to default remote
> 
> ... or default "push remote" if there is one, I presume?
> 
> As you are giving what to push, I am assuming that
> branch.$name.remote would not come into play in this case.

I would have assumed the opposite. We feed "push" two items: where to push (dst), and what refspecs to push (refs). We may or may not have each item. Here's what's possible today:

  dst=present, refs=present: (case 1)
    push to $dst, using $refs
  dst=present, refs=missing: (case 2)
    push to $dst, using refspecs from remote.$dst.push or push.default
  dst=missing, refs=missing: (case 3)
    push to remote.pushDefault, branch.*.remote, or "origin"; use
    refspecs from remote.$x.push or push.default, where $x is the remote
    we decide to use.
The missing case 4 is obviously:
  dst=missing, refs=present

And I would expect it to select the remote in the same way as case 3. In other words, the "where" and the "what" are orthogonal, and the presence or absence of one does not affect how the other is calculated (with the exception that _if_ we have a configured remote, whether it was specified by the user or calculated, we may use its config if no refspecs are specified).

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).

Show 8 quoted lines
> > 	git push origin korg --; # push default refspec to 2 remotes, again
> 
> As you are _not_ saying what to push, I would expect
> branch.$name.remote may have to come into the picture, but because
> you are saying where to push, that is not the case.  What does
> "default refspec" mean in this context?  What "git push origin" (no refspecs)
> would push by default will be sent to "origin", and what "git push
> korg" (no refspecs) would push by default will be sent to "korg"?

Yeah, I would expect that each uses its own default refspec. That is, the above command is exactly equivalent to:

  git push origin && git push korg

(possibly without the short-circuit behavior of "&&", but definitely taking both into account in the exit code).

I'd also be fine if we punted on the multiple remotes thing for now. You can accomplish it easily in the shell, as I showed above (and it is not any less efficient, since we have to make two network connections anyway). Jonathan's syntax allows for 0 to N remotes alongside 0 to N refspecs. The interesting new case (to me, anyway) is the 0 remotes, >0 refspecs case. But we don't have to handle >1 remotes now; once we have the syntax in place, we can make it work later when we've decided on the semantics.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 22 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.