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

Re: [PATCH v2] Add push --set-upstream

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 15, 2010, 23:40 UTC
Message-ID
<7vzl4frl7i.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1263595630-18962-1-git-send-email-ilari.liusvaara@elisanet.fi>
Ilari Liusvaara <ilari.liusvaara@elisanet.fi> writes:
Show 8 quoted lines
> @@ -974,6 +1016,10 @@ int transport_push(struct transport *transport,
>  	verify_remote_names(refspec_nr, refspec);
>  
>  	if (transport->push) {
> +		/* Maybe FIXME. But no important transport uses this case. */
> +		if (flags & TRANSPORT_PUSH_SET_UPSTREAM)
> +			die("This transport does not support using --set-upstream");
> +

Would it be better to just warn() and continue instead of dying? I think it can be argued both ways, and I personally think die() is better by making it more visible that the user does not have the config s/he wanted to add, but I am pointing it out just in case somebody thinks of a better solution (of course, doing an extra ls-remote and doing the configuration is such a "better solution" but that is not what I mean---I am not that greedy).

Show 10 quoted lines
> @@ -1002,6 +1048,9 @@ int transport_push(struct transport *transport,
>  					verbose | porcelain, porcelain,
>  					nonfastforward);
>  
> +		if (flags & TRANSPORT_PUSH_SET_UPSTREAM)
> +			set_upstreams(transport, remote_refs);
> +
>  		if (!(flags & TRANSPORT_PUSH_DRY_RUN)) {
>  			struct ref *ref;
>  			for (ref = remote_refs; ref; ref = ref->next)

Shouldn't this honor TRANSPORT_PUSH_DRY_RUN? IOW, when should it touch the configuration if you do this sequence?

	# I am paranoid and want to check what happens first
	git push -n --track there this
        # Ok let's do it for real.
        git push    --track there this
Previous: Ilari LiusvaaraNext: Junio C Hamano
Message 2 of 15 in “Add push --set-upstream”
  1. Add push --set-upstreamIlari Liusvaara, Jan 15, 2010
  2. Junio C HamanoJan 15, 2010
  3. Junio C HamanoJan 15, 2010
  4. Nanako ShiraishiJan 16, 2010
  5. Junio C HamanoJan 16, 2010
  6. Tay Ray ChuanJan 16, 2010
  7. Sverre RabbelierJan 16, 2010
  8. Tay Ray ChuanJan 16, 2010
  9. Sverre RabbelierJan 16, 2010
  10. Junio C HamanoJan 16, 2010
  11. Junio C HamanoJan 16, 2010
  12. Tay Ray ChuanJan 16, 2010
  13. Nanako ShiraishiJan 16, 2010
  14. Tay Ray ChuanJan 16, 2010
  15. Rudolf PolzerJan 16, 2010

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.