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

Re: [PATCH] push: error out when the "upstream" semantics does not make sense

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 5, 2012, 18:43 UTC
Message-ID
<20120405184345.GA6448@burratino>
In-Reply-To
<7v1uo26ue9.fsf_-_@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> --- a/builtin/push.c
> +++ b/builtin/push.c
> @@ -65,6 +65,16 @@ static void set_refspecs(const char **refs, int nr)
[...]
Show 9 quoted lines
> @@ -87,6 +97,11 @@ static void setup_push_upstream(struct remote *remote)
>  	if (branch->merge_nr != 1)
>  		die(_("The current branch %s has multiple upstream branches, "
>  		    "refusing to push."), branch->name);
> +	if (strcmp(branch->remote_name, remote->name))
> +		die(_("You are pushing to remote '%s', which is not the "
> +		      "upstream of your\ncurrent branch '%s'.\n"),
> +		    remote->name, branch->name);
> +

I worry that a beginner seeing this message would think it means that when "master" is set up to track origin/master that there is no way to push that branch to any other repository.

Maybe something like
		die(_(
"You are pushing to remote '%s', which is not the upstream of your\n"
"current branch '%s', without specifying a refspec.\n"),
		    remote->name, branch->name);
would be harder to misunderstand.
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 11 in “What's cooking in git.git (Apr 2012, #02; Wed, 4)”
  1. Junio C HamanoApr 4, 2012
  2. Jeff KingApr 5, 2012
  3. push: error out when the "upstream" semantics does not make senseJunio C Hamano, Apr 5, 2012
  4. Jonathan NiederApr 5, 2012
  5. Junio C HamanoApr 5, 2012
  6. Jonathan NiederApr 5, 2012
  7. Junio C HamanoApr 5, 2012
  8. Jonathan NiederApr 5, 2012
  9. Matthieu MoyApr 5, 2012
  10. Junio C HamanoApr 5, 2012
  11. Matthieu MoyApr 6, 2012

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.