Article View: linux.kernel.git
Article #1781Re: [PATCH] remote: resolve "simple" @{push} when pushing to another remote
From: "D. Ben Knoble"
Date: Wed, 28 Oct 2026 22:24
Date: Wed, 28 Oct 2026 22:24
87 lines
15465 bytes
15465 bytes
On Tue, Oct 27, 2026 at 8:48 AM Harald Nordgren via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Harald Nordgren <haraldnordgren@gmail.com>
>
> With push.default left at "simple", a branch whose upstream is on one
> remote and whose push remote is another gets pushed by "git push" to a
> branch of the same name on the push remote. But @{push} for that
> branch fails with "cannot resolve 'simple' push to a single
> destination".
At first I was a bit confused about the need for a different push
remote, but then I realized: simple's documentation says that if the
push and pull remote are the *same* you need the upstream to have the
same name! So in the differing case, it might behave quite differently
than I'm used to.
> "git push" learned to handle "simple" this way in ed2b18292b (push:
> change `simple` to accommodate triangular workflows, 2013-06-19). When
> @{push} was added in e291c75a95 (remote.c: add branch_get_push,
> 2015-05-21), its "simple" case only covered pushing back to the remote
> the branch is fetched from, where the upstream must have the same name.
>
> Make @{push} follow "git push". When the push remote is not the remote
> of the branch, resolve to the branch of the same name on the push
> remote, as "current" does.
Whatever else we do, making @{push} work in more scenarios seems good
to me so we can be consistent.
> The test added in 9bf9eed093 (remote: fix leak in branch_get_push_1()
> with invalid "simple" config, 2026-01-19) relied on a different push
> remote being invalid for "simple". Use an upstream with a different
> name on the same remote instead, so that it still exercises the error
> path.
>
> Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
> ---
> remote: resolve "simple" @{push} when pushing to another remote
>
> With push.default=simple and remote.pushDefault pointing at a fork, git
> push pushes the branch to the fork, but @{push} fails with "cannot
> resolve 'simple' push to a single destination".
>
> So git status cannot compare the branch with where it was pushed. Make
> @{push} resolve to where git push goes.
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2466%2FHaraldNordgren%2Fat-push-simple-triangular-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2466/HaraldNordgren/at-push-simple-triangular-v1
> Pull-Request: https://github.com/git/git/pull/2466
>
> remote.c | 4 ++++
> t/for-each-ref-tests.sh | 4 +++-
> t/t1514-rev-parse-push.sh | 11 +++++++++++
> 3 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/remote.c b/remote.c
> index 49ee2ea318..fd434a3a10 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -2016,6 +2016,10 @@ static char *branch_get_push_1(struct repository *repo,
> const char *up;
> char *cur;
>
> + if (strcmp(remote->name,
> + remotes_remote_for_branch(remote_state, branch, NULL)))
> + return tracking_for_push_dest(repo, remote, branch->refname, err);
This certainly matches the logic described in the log message, and I
think it's probably right based on that description. One thing I can't
decide is whether it should come before or after the current set of
cases, and I'm undecided. On one hand, it's a new case, so I would
think it should come after. OTOH, it's a fairly straightforward case,
and I usually like discharging those early so I can focus on the
complex stuff.
So, I would say this is probably fine as-is?
[Skipping the tests for now]
Technical Details
Message-ID:
<CALnO6CBxMrv01NMqEPCLbGbCPXX9T2Jgjax-L5s2z9s-eUpNDQ@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73703-linux-kernel-git=dewy.ruReferences:
<pull.2466.git.git.1793105039624.gitgitgadget@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73703-linux-kernel-git=dewy.ru
From: ben.knoble@gmail.com ("D. Ben Knoble")
Newsgroups: linux.kernel.git
Subject: Re: [PATCH] remote: resolve "simple" @{push} when pushing to another remote
Date: Wed, 28 Oct 2026 18:24:51 -0400
Organization: Usenet Network
Message-ID: <CALnO6CBxMrv01NMqEPCLbGbCPXX9T2Jgjax-L5s2z9s-eUpNDQ@mail.gmail.com>
References: <pull.2466.git.git.1793105039624.gitgitgadget@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="1883675"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:wMjntQyzQV+XO3Ry9j3K7ew/rjs= sha256:wpypont+d3Umh74rxBegVdxX1NsdLX9jEbMcdWiseds=
sha1:FiIRR2Av/DV2nKCrU+6arUJqbp0= sha256:UoDQPZJdvIbTNDKCrJCI2x4keTOhQ47UBn62os5k03A=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 9F5E1125C4C; Thu, 29 Oct 2026 01:29:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id xQmCqMkgEXEA;
Thu, 29 Oct 2026 01:29:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-73703-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 02DA6125C4E; Thu, 29 Oct 2026 01:29:34 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 888B32E54B; Wed, 28 Oct 2026 22:25:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1793226305;
b=TvootEu4Sp2rNiFxXlz50Xqk02krmAOeg7ukZ+s7W2GoUEz0f5cax3xH0LF2OLFdg/BX
B7kNpOXpiijmUmIHDfHLGxBN2P8frJ5uLwY3dYM+N24wT5kH+F/KjVgfJr47fzuw4d3CP
sMFAaruu/G5RpQyV0joXYdAqSO9f/8iXKQDinxSpHTmVIFeUVFfG3I+ORBAuyhVJCIXHe
4nfKqB1hoXJ4EeehjJY+VQDh4xF0pKiOE5Bv9k34r0t+VqjlHPN3eRy1OYmdl0gY5P8ji
DNWv8MxMYTmNJSILVOpYM7+kajhtIQDVmVM8/nMwYWoG1TZDFkQLNW48ZAqWpwftsrQ==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793226305;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:References:
In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=7uxc2T0TlvVMtM+z3NhNfugDPhZRH7Gm4PAr/PAh7XA=;
b=3+nK3I4HQhAQcp13xl24j1EwMjDxkXwTNT193HI1VFp3E9PNjCreUJi2aXJFiL0/XBaH
ptjrNIVlWGs9IJXah98svWZNBHaVFUNlty430YCK3DCI8Yx7KKefoaZmz/sHqjpOmLg2q
2tAZ8yAEqye7Dz8AN2wE3FOL+xY7j/qXWPI00bhwFqjx+sUgLBSY+z8uosxRcARa8L0qk
xS8sPl+6ptbrTDmMZ6zH9iBYIhi7h6w1GjEfogksXqbtMCdnWmodRxupLBLCyJWfp7QR2
xMbR7Bsc0zEjN1sXEHgrWDG7wJn77ItqEgdMEvYsYfUEdruQoaJ9gOEsgjnh0OdovOQ==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="mkOZJ/0O";
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E09D606A31E;
Wed, 28 Oct 2026 22:25:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=mkOZJ/0O
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.210.176
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1793226304;
b=4h+2uA/W6Gs4/Bu38Fm452G9YwfwrvWbAqd9tQ6HpS6mdpahbp05jFfoiSxXvGWeweMo
Li2QkGpvFt3+/Sw2TtO7apU7qOdhtJ9tUPPng88KgSykbTljuYJYyTl2Nf7Ydv/92qnZC
wm1I/ho5kgP08n0zYuYDu4dMAGM8QWrcTxb9aEHZmIF6AnzoXMxJ1I69b7e4ux90uMjuK
zww9otpxx4k3GWMfDIvGGwXNNi+M4KBG5lZoHOTdGsF5A0xdvcVpHOcZsa8E4577e6luz
Ev9ewxfOJVm5D0FXua4U7gfEAvC/NTR+TnU9lDxd/4mxkTLuJLHicmseku0rQzkwrRQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793226304;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:MIME-Version:References:
In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=7uxc2T0TlvVMtM+z3NhNfugDPhZRH7Gm4PAr/PAh7XA=;
b=LfxEBFUzgqJf5+5YUrn4QQL6ek9T4wbyGcBkv5AzIhIux0HrPFWx7ROk/aerhGRQbm6w
pqHeClzz2I/n/ck2YWR36QZYGHXMN4p92J160y0OKi+MgsuJU7lk91fDxZ+/dryutnzyO
o8M3TUcHBuwaPHU+DVRK3FNWdgfp0LvmSyU12puYnJigPOzM2wfIAIoA4eZMh5pxrB+Mj
O6SdfIPRxO3rnWG49BO5D1F3MEfosDoNCLG4FB1WpcAjQ/OMlhXewusQdbWOCdvjv+9lj
NDwyOuO5MYmJPlEzatj8GJbCmu+/liRCLok3h1H/Ynj4cblmc9KXWt0fQrzx3fYCFvQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="mkOZJ/0O";
arc=pass header.oldest-pass=0 smtp.remote-ip=209.85.210.176
X-Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B826606A329
for <git@vger.kernel.org>; Wed, 28 Oct 2026 22:25:03 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1B826606A329
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-8a39e5161c1so1127009b3a.3
for <git@vger.kernel.org>; Wed, 28 Oct 2026 15:25:03 -0700 (PDT)
X-ARC-Seal: i=1; a=rsa-sha256; t=1793226303; cv=none;
d=google.com; s=arc-20260327;
b=j109U+un3+girlLoje0yg7NvTb36FR9l8FbgLD2q+2y2tcAv1klFa7Y0mCRp9JtOLN
A7u5PnG167ciYCnPijBHZ9nKNsMGcgYOoyyajn8oMgYkshi24g0eNNZnuU8zCoFI3W8y
J3uoq+lz/w7QH5HJjvAmst7tF0AX9Imca4Pw9t2n9g1obKswIjgxEnCssOqPW+HNa4XO
ov0DezFtcKTHSelVzJYhpFk3MLxuA9e3KInKs+PY2tAJR/Cap+UhGXNlYk0HFjSN4j4G
Fxw5KWFk1bj4/axOihHLxgxfxzi3s4rU0QFvqjrWYUucXa63gzxyz7ZO9GaSxJG4DCki
/qxg==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:dkim-signature;
bh=7uxc2T0TlvVMtM+z3NhNfugDPhZRH7Gm4PAr/PAh7XA=;
fh=Ox4D5aCb0Wm3NuWmIZhbrD5IUgm6JPtaEE6xbKungY4=;
b=S30dAxQ7Wnj/Ny00LrxwcachK/YUIyo36nxmHG+1Xf3/o9N5Ejf+TZZ+mN0C61c+R/
qtOW4dYWlZ6pgHt9mG3LWvkAu5VmyHw92NLZvX/DmPlAfNuvQ30qPu63wnsnd2zicp4y
ICYdnduTC0EM+NEnbGf+OIS4d3Rcz7Lxsh4iQyZDY4JuFIOHJUW/Htu0BA3Ml0iIjyBO
3jUmfgmlw999wYiMSXGRRLE1jzdEs0kbwZgrPmC84FI+ycmgNNExs6IvrHyEvNbHIW4N
JRE++rf3qgfOODy3n9xMn8NguqCDJKnWjSNnUPgOGWQH1EdU5CFQkbsSK6DFf4wgyx11
V7ww==;
darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1793226303; x=1793831103; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=7uxc2T0TlvVMtM+z3NhNfugDPhZRH7Gm4PAr/PAh7XA=;
b=mkOZJ/0Os613ks56qzRR503/8QgpasDZTfVubCA0hWDcCJe26oJIdbtaaL0ZNdyjeU
tN+8VbXe/DD139yoLfFjKg1fBj+zOy9PRO/k4bq0tm9NyTkZOIMZa0FYb53tO3kjw8sO
Hdd5AxEE0iHjO/h6aET1dYrKnGnKV6Of9cobmsVDeqaO/DwFXCzxRa9wXxcnTkq0z48e
WYJLY35ZNTeRLVIUU++iOVGf08MAKSWrjffED4A7tCXSWcxqDwyBgwua/v72lq1kTTbE
P0+ynd30FnqeWwwP8P5ljxfAKqf0Run93CogiXvqrRQm4wJeOazbUpySQl2draybEMXa
jTDA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793226303; x=1793831103;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=7uxc2T0TlvVMtM+z3NhNfugDPhZRH7Gm4PAr/PAh7XA=;
b=t8SmLDWipUR2Z3dboukRx/yziSNjZUYfOl1QZIpeQrWkSn4u/gjC9UzD0od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045810b3a.12.1793226303327; Wed, 28 Oct 2026
15:25:03 -0700 (PDT)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <pull.2466.git.git.1793105039624.gitgitgadget@gmail.com>
X-Gm-Features: AclHuK83Mgf3bHuTaQFuftPHXia41z7hU_go5C_JWOE_WgJ3FeE2NNIzziQZvrg
X-Cc: git@vger.kernel.org, Harald Nordgren <haraldnordgren@gmail.com>