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

Re: [PATCH 3/3] remote: introduce and fill branch->pushremote

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 13, 2014, 20:15 UTC
Message-ID
<xmqqtxd763lf.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140113185946.GA30279@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> It does not matter for actually pushing, because to do a non-default
> push, you must always specify a remote. But "@{publish}" will ask the
> question "even if I am on 'side' now, what would happen if I were to
> default-push on 'master'?".

In a similar wording to yours, it can be said that B@{upstream} is "what would happen if I were to default-pull on 'B'?".

A related tangent is what should B@{publish} should yield when there is no triangular configuration variables like remote.pushdefault, branch.B.pushremote and a possible future extension branch.B.push are defined. The definition you gave, i.e. "if I were to default-push", gives a good guideline, I think.

I.e. "git push origin master" does tell us to push out 'master', but it does not explicitly say what ref to update. It may be set to update their remotes/satellite/master when we are emulating a fetch in reverse by pushing, via e.g.

	[remote "origin"]
        	push = refs/heads/master:refs/remotes/satellite/master

and it would be intuitive if we make "master@{publish}" resolve to "refs/remotes/satellite/master" in such a case.

One thing that makes things a bit fuzzy is what should happen if you have more than one push destinations. For example:

	[remote "home"]
        	pushurl = ...
                push = refs/heads/master:refs/remotes/satellite/master
	[remote "github"]
        	pushurl = ...
                mirror
	[remote]
        	pushdefault = ???

"git push home" updates their 'refs/remotes/satellite/master' with my 'master' with the above, while "git push github" will update their 'refs/heads/master' with 'master'.

We can say master@{publish} is 'remotes/satellite/master' if remote.pushdefault (or 'branch.master.pushremote") is set to 'home', it is 'master' if it is 'github', and if "git push" while sitting on 'master' does not push it anywhere then master@{publish} is an error. There may be a better definition of what "if I were to default-push" really means, but I don't think of any offhand.

Previous: Jeff KingNext: Jeff King
Message 8 of 9 in “Minor preparation for @{publish}”
  1. 0/3 Minor preparation for @{publish}Ramkumar Ramachandra, Jan 12, 2014
  2. 1/3 t1507 (rev-parse-upstream): fix typo in test titleRamkumar Ramachandra, Jan 12, 2014
  3. 2/3 interpret_branch_name: factor out upstream handlingRamkumar Ramachandra, Jan 12, 2014
  4. 3/3 remote: introduce and fill branch->pushremoteRamkumar Ramachandra, Jan 12, 2014
  5. Jeff KingJan 13, 2014
  6. Ramkumar RamachandraJan 13, 2014
  7. Jeff KingJan 13, 2014
  8. Junio C HamanoJan 13, 2014
  9. Jeff KingJan 13, 2014

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.