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

Re: [PATCH 2/4] push: make upstream, simple work with pushdefault

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Jun 10, 2013, 11:48 UTC
Message-ID
<CALkWK0mY5=H6FoUZCOXTYykEV1f=3wrP21WPXj1v4VBCeOxocg@mail.gmail.com>
In-Reply-To
<7v4nd6l31d.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 5 quoted lines
> The name under which the local branch is published needs a sensible
> default (when branch.$name.push is not specified), and I agree that
> you would get the name of the branch my work was forked from if you
> reuse the "upstream" code.  I am saying that it does not necessarily
> give us a good default.

See, that's the problem: push.default is simply a default refspec to push to for all branches, that can be _overridden_ by branch.<name>.push. Getting an override is not going to solve the problem we are facing: what to do when branch.<name>.push is unspecified? Fall back to push.default, right?

> Now think _why_ I renamed the branch on my end, i.e. not calling
> that branch in question "triangle" that is the blanket name for the
> collective effort but calling it with a more specific name
> "pushbranch", in the first place.

Look, it's very simple. upstream was built to support the case when the local branch name is different from the remote branch name, but it was too specialized for central workflows. How do we extend it for triangular workflows?

Just like we introduced branch.<name>.pushremote to override branch.<name>.remote, we get branch.<name>.push to override branch.<name>.merge. If branch.<name>.pushremote is unset, where do the pushes go? branch.<name>.remote. If branch.<name>.push is unspecified, what is the refspec to be pushed? branch.<name>.merge (when push.default = upstream) [*1*].

What does this mean? I publish the branch "triangle" on ram (what my local branch is called or what push.default I use is irrelevant). You have a branch called pushremote with branch.pushremote.remote set to ram, remote.pushdefault set to junio, branch.pushremote.merge set to refs/heads/triangle, and push.default set to upstream.

  # on jc's machine; on branch pushremote
  $ git pull
  # integrates changes from ram's triangle just fine
  $ git push
  # publishes the branch as triangle on remote junio
I rewrite my branch, and you have 4 commits based on my branch:
  $ git rebase --onto @{u} @~4
Perfect.
The only limitation is that you don't choose the branch name on junio.
 When we get branch.pushremote.push, you'll be able to set it to
refs/heads/pushremote, making push.default inconsequential.  Done.
[Footnotes]

*1* remote.pushdefault overrides branch.<name>.remote, while push.default will be overridden by a future branch.<name>.push. Not exactly elegant, is it?

Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 16 in “Fix triangular workflows for upstream, simple”
  1. 0/4 Fix triangular workflows for upstream, simpleRamkumar Ramachandra, Jun 9, 2013
  2. 1/4 t/push-default: remove redundant test_config linesRamkumar Ramachandra, Jun 9, 2013
  3. 2/4 push: make upstream, simple work with pushdefaultRamkumar Ramachandra, Jun 9, 2013
  4. Junio C HamanoJun 9, 2013
  5. Ramkumar RamachandraJun 10, 2013
  6. Junio C HamanoJun 10, 2013
  7. Ramkumar RamachandraJun 10, 2013
  8. Junio C HamanoJun 10, 2013
  9. Ramkumar RamachandraJun 10, 2013
  10. Junio C HamanoJun 10, 2013
  11. Ramkumar RamachandraJun 13, 2013
  12. Junio C HamanoJun 13, 2013
  13. Junio C HamanoJun 13, 2013
  14. Ramkumar RamachandraJun 13, 2013
  15. 3/4 t/push-default: generalize test_push_{success, commit}Ramkumar Ramachandra, Jun 9, 2013
  16. 4/4 t/push-default: test pushdefault with all modesRamkumar Ramachandra, Jun 9, 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.