Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Tao Klerks via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Tao Klerks <tao@klerks.biz>
Subject: Re: [PATCH] rev-parse: respect push.autosetupremote when evaluating @{push}
Date: Sun, 10 Jul 2022 13:42:42 -0700	[thread overview]
Message-ID: <xmqq5yk4r96l.fsf@gitster.g> (raw)
In-Reply-To: <pull.1279.git.1657480594123.gitgitgadget@gmail.com> (Tao Klerks via GitGitGadget's message of "Sun, 10 Jul 2022 19:16:33 +0000")

"Tao Klerks via GitGitGadget" <gitgitgadget@gmail.com> writes:

> +	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 ...

> +		{
> +			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 ...

> +		}
>  	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?


  reply	other threads:[~2022-07-10 20:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-10 19:16 [PATCH] rev-parse: respect push.autosetupremote when evaluating @{push} Tao Klerks via GitGitGadget
2022-07-10 20:42 ` Junio C Hamano [this message]
2022-07-16 17:40   ` Tao Klerks
2023-05-28  9:58 ` [PATCH v2] " Tao Klerks via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq5yk4r96l.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=tao@klerks.biz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).