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?