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

Re: Using push.default with push.remote.push

From
Jeff King <peff@peff.net>
Date
Mar 11, 2020, 19:10 UTC
Message-ID
<20200311191021.GA27978@coredump.intra.peff.net>
In-Reply-To
<CAHd499AGQ5k7ON+YY84b6LY1sh9MOw8fsrE2shOibujX1iKeiQ@mail.gmail.com>
On Wed, Mar 11, 2020 at 11:56:05AM -0500, Robert Dailey wrote:
Show 10 quoted lines
> > Then when would remote.*.push with a wildcard ever do anything?
> 
> Maybe this is where a potential disconnect is, but I've always viewed
> the wildcard refspec as a mapping, rather than an all-inclusive "Push
> all the things". In other words, I view it as more of a structural
> guide than a behavioral one. I recognize I probably have this wrong,
> but it probably speaks to how some users view it, or at least, some
> valid use cases to have more of a structural mechanism to map branches
> to remote repositories, with `git push --all` being a supplement to
> say "Push all branches using this mapping".

I see. So you really want "push the current branch by default, but using this refspec to map the names". That doesn't exist right now, but it seems like it would be a reasonable thing to have.

Bringing in your other reply:
Show 6 quoted lines
> I think `branch.*.pushRef` in this case is not enough. It implies that
> for every branch I want to be mapped in this way, I'd have to manually
> specify this config. Rather, I think a `remote.*.pushRef` would be
> more appropriate, so that it would automatically set the
> `branch.*.pushRef` version as needed, so I only set up the mapping
> once.

Yes, my suggestion would require per-branch config. And something like remote.*.pushRef makes sense to me as the implementation for what we were discussing above. I think you'd want the name to somehow indicate that it's a mapping to be used when pushing a ref, and not the definitive "this is what we will push" directive.

I don't think it would make sense to use with something like "upstream" in push.default, because that's mapping the name already. So possibly it should be restricted to "current". I suppose it would also make sense with "matching". There the current remote.*.push _mostly_ does the same thing, but with one subtle exception that it pushes everything that matches the left-hand side of the refspec, not just ones that exist on the right-hand side.

So I dunno. I could see it as being limited to "current", or being applied as it makes sense for each individual push.default. I'll leave that to whoever decides to work on the feature. :)

-Peff
Previous: Robert Dailey
Message 6 of 6 in “Using push.default with push.remote.push”
  1. Robert DaileyMar 11, 2020
  2. Robert DaileyMar 11, 2020
  3. Jeff KingMar 11, 2020
  4. Robert DaileyMar 11, 2020
  5. Robert DaileyMar 11, 2020
  6. Jeff KingMar 11, 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.