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

Re: [PATCH] rev-parse: respect push.autosetupremote when evaluating @{push}

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 10, 2022, 20:42 UTC
Message-ID
<xmqq5yk4r96l.fsf@gitster.g>
In-Reply-To
<pull.1279.git.1657480594123.gitgitgadget@gmail.com>
"Tao Klerks via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 6 quoted lines
> +	if (branch && (!branch->merge || !branch->merge[0])) {
> +		repo_config_get_bool(the_repository,
> +				     "push.autosetupremote",
> +				     &autosetupremote);
> +		if (autosetupremote)
> +			return tracking_for_push_dest(remote, branch->refname, err);

Before the first push of the branch X where we are asking for X@{push}, i.e. there is not the corresponding branch over there yet and we do not have the remote-tracking branch for it yet, what does this function return? If it continues to error out, then I think this patch may make sense, but ...

Show 6 quoted lines
> +		{
> +			const char *up;
> +			up = default_missing_upstream(remote, branch, err);
> +			if (up)
> +				return up;
> +			return branch_get_upstream(branch, err);
... shouldn't the precedence order the other way around here ...
Show 13 quoted lines
> +		}
>  	case PUSH_DEFAULT_UNSPECIFIED:
>  	case PUSH_DEFAULT_SIMPLE:
>  		{
>  			const char *up, *cur;
>  
> +			up = default_missing_upstream(remote, branch, err);
> +			if (up)
> +				return up;
> +
>  			up = branch_get_upstream(branch, err);
>  			if (!up)
>  				return NULL;

... and here? That is, if branch_get_upstream() finds an explicitly configured one, shouldn't we use that and fall back to the new "missing" code path only when there isn't an explicitly configured one?

Previous: Tao Klerks via GitGitGadgetNext: Tao Klerks
Message 2 of 4 in “rev-parse: respect push.autosetupremote when evaluating @{push}”
  1. rev-parse: respect push.autosetupremote when evaluating @{push}Tao Klerks via GitGitGadget, Jul 10, 2022
  2. Junio C HamanoJul 10, 2022
  3. Tao KlerksJul 16, 2022
  4. rev-parse: respect push.autosetupremote when evaluating @{push}Tao Klerks via GitGitGadget, May 28, 2023

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.