🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1920

[PATCH v13 6/6] remote: resolve @{push} through remote.<name>.fetchRefmap

#1920
From: "Harald Nordgren via GitGitGadge...
Date: Fri, 30 Oct 2026 10:52
62 lines
12959 bytes
From: Harald Nordgren <haraldnordgren@gmail.com>

A branch pushed to a remote set up with "git remote add
--limited-fetch" has no remote.<name>.fetch entry to map it
through, so @{push} cannot tell where it landed and fails with
"has no local tracking branch".

Give tracking_for_push_dest() the same fallback to
remote.<name>.fetchRefmap that get_ref_map() uses on the fetch
side, so a --limited-fetch remote supports @{push} resolution
the same way any other remote does.

Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
---
 remote.c                  |  2 ++
 t/t1514-rev-parse-push.sh | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/remote.c b/remote.c
index 15cd96aa8e..ecd104766c 100644
--- a/remote.c
+++ b/remote.c
@@ -2018,6 +2018,8 @@ static char *tracking_for_push_dest(struct repository *repo,
 
 	remote = repo_remote_for_push_tracking(repo, remote);
 	ret = apply_refspecs(&remote->fetch, refname);
+	if (!ret)
+		ret = apply_refspecs(&remote->refmap, refname);
 	if (!ret)
 		return error_buf(err,
 				 _("push destination '%s' on remote '%s' has no local tracking branch"),
diff --git a/t/t1514-rev-parse-push.sh b/t/t1514-rev-parse-push.sh
index 5a4f16867a..bcf00107f5 100755
--- a/t/t1514-rev-parse-push.sh
+++ b/t/t1514-rev-parse-push.sh
@@ -80,4 +80,23 @@ test_expect_success 'resolving @{push} fails with a detached HEAD' '
 	test_must_fail git rev-parse @{push}
 '
 
+test_expect_success '@{push} resolves after pushing to a --limited-fetch remote' '
+	test_when_finished "rm -fr upstream fork downstream" &&
+	git init -b main upstream &&
+	test_commit -C upstream base &&
+	git init --bare fork &&
+	git clone --sparse upstream downstream &&
+	(
+		cd downstream &&
+		git remote add --limited-fetch fork ../fork &&
+		git config push.default current &&
+		git config remote.pushDefault fork &&
+		git checkout -b topic main &&
+		test_commit on-topic &&
+		git push &&
+		resolve topic@{push} refs/remotes/fork/topic &&
+		test_cmp_rev topic topic@{push}
+	)
+'
+
 test_done
-- 
gitgitgadget
Technical Details
Message-ID: <25eec8d9676d4adf82570616ca88a2b38d20afa4.1793357550.git.gitgitgadget@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-73889-linux-kernel-git=dewy.ru
References: <pull.2412.git.git.1789829246437.gitgitgadget@gmail.com> <pull.2412.v13.git.git.1793357550.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-73889-linux-kernel-git=dewy.ru
From: gitgitgadget@gmail.com ("Harald Nordgren via GitGitGadget")
Newsgroups: linux.kernel.git
Subject: [PATCH v13 6/6] remote: resolve @{push} through
 remote.<name>.fetchRefmap
Date: Fri, 30 Oct 2026 10:52:30 +0000
Organization: Usenet Network
Message-ID: <25eec8d9676d4adf82570616ca88a2b38d20afa4.1793357550.git.gitgitgadget@gmail.com>
References: <pull.2412.git.git.1789829246437.gitgitgadget@gmail.com>
	<pull.2412.v13.git.git.1793357550.gitgitgadget@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2220547"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gU8OKY3d+p6yyYbdlqXfGmyvJjc= sha256:5NmLrbfqmaBlInOP980MwGYY+3VOTilGmm1d6C6iQi0=
	sha1:ANkdslh1CqX5FNpQZdlrVcpkTvU= sha256:+mNlscbvROQJGoRbIgzgGHVCJg2SgUUdFYRq6GW21U0=
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 E9B3D125C92; Fri, 30 Oct 2026 14:19:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.947
X-Spam-Status: No, score=-1.947 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, 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, URIBL_BLOCKED=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 1AmUTe6U3gGn;
	Fri, 30 Oct 2026 14:19:52 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-73889-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 17B3E125C91; Fri, 30 Oct 2026 14:19:43 +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 319063992D; Fri, 30 Oct 2026 10:57:37 +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=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793357577;
	b=Qh95DOXB3Bj3mCvOybWUaAm+JyuGZmXfJ09fplgA9vi2p3MY3Vvg3wX+VOU9nkDGaY54
	 7f1KFDhIIZBOSTa5SSO4X3xuwmwiIKGUC7rZWDS0Gf06+RbXAosOBNrzzZnE/eooFombL
	 LlbQKeCb5rxcU9gq/GXEE9PWdM2h09rr0eBg8QaOD5NNICBRvhkKN8hNHUOTH/RfRQ52e
	 SdOdzzvyWbptqGdz9ZgJ35M4a/waMx8tNohAl1fq28qKD9LcX3huN5j6XB57Os93dr3Ek
	 bWwSXDDskF0IDaRHaJgT4n/LUDp5VpSMBzHoq4YwHK+DcaFfDmiWt/hXT4bdetwKFpA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793357577;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Message-Id:In-Reply-To:References:From:Date:Subject:Fcc:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:To:Cc;
	bh=eFasx2F2M8RCxA7v4JWIW0/D8AW3uMa5Y/Vs8OvI1A8=;
	b=39lE13fl2FXtY4fQTLn6ehp+KeXEx4T+8eOKIUqmgUkzqXVAeqsYuBfpeMUhjvohCrDe
	 DuWL6uTw6m6bVCMId4wjypNJGdZeHor2rVd7cacN9iWxdkjuyms9bPXj1nqezkKUeghmH
	 lkH7Cnsm+NiWD5MOy14Qsq6Nj6TiFIwrhg3jIbkUh3b9m/EWdxDbLaAIki7ZA1rxlF8Ak
	 1bOWU6V+SLJ3gJhEzeiv/6FZh6Fdvjk38Q7b9vmKBmNt+q6ACrCkIkND2KJzvbUl4R6l9
	 vLRfofN7uu21OwL2tm4isIoS9X8ynWLbecu1HTr75zDGs25/TDlN9A1qkhNezHpzZBQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=l4U7ZnTF;
	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 6B9DB60A261E;
	Fri, 30 Oct 2026 10:52:57 +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=l4U7ZnTF
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.41
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793357576;
	b=Q5O7kzBGxt9DCsCuEUsYGJu29jDfQAwE+cVaMAxrpGW1KGmBuzB5ikpFHUyjX/VidbU+
	 ZWPqLQFFiJ9VF38dt+SwwvXrSMEwgTZ9zj7QYz0jpF302wpN3YOOH6ci4afaiCLP+NNBc
	 JF8afkc0qNCdGK94PeQjldAW5bej66dTreSmaFPVvIM4AYC77UPAvlEFnOYfeup4Q3z3w
	 lgRoJdLj7J9MXrAac9hAIcU8tMc3peF+euuHEJAMGI52ohArpyIPM1+o51xnANKCGmnGg
	 JF/Jc+EGiqL61zUKmMoeg6zajnrYhaY0JLAEk46r/eK7kobV8O5mq91Inj2rUAYc47g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793357576;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-Id:In-Reply-To:
	 References:From:Date:Subject:Fcc:Content-Type:
	 Content-Transfer-Encoding:MIME-Version:To:Cc;
	bh=eFasx2F2M8RCxA7v4JWIW0/D8AW3uMa5Y/Vs8OvI1A8=;
	b=EJXpDuruN1JpzHMHPUhunSt8ZMZ1D1yDiVtLIy+qDhQqYxifJlNn4J8rr67CmFRanJb+
	 Rj9Qv6+mIomvHgBQ3DvvVin6VaKz6m43rh/nYHS+4bm+9Dmm1kAtyCx4JMZn+a4qNZiZ5
	 Kew23SP162vNhHQQ2ep6ifcrcI5zNk8gg+xMZk0Il5QmtJ+84dffrKWKjAr1t6jYw71Ma
	 H2nTo5e5GcI98oZ1YS1iiUj0AmSVLWF4SdgafnvtqZu07O1Kmh1ayLvtIwVjYNnjTMlmQ
	 WYLdW4sdZMVjhXjflpHiu1BeCJxwc4wavMiUwStuYsjD42rHhCKIYUvtXqTHks+wjoA==
X-ARC-Authentication-Results: i=1; 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=l4U7ZnTF;
	arc=none smtp.remote-ip=209.85.161.41
X-Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41])
	(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 3D2DB606C4F2
	for <git@vger.kernel.org>; Fri, 30 Oct 2026 10:52:56 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3D2DB606C4F2
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-oo1-f41.google.com with SMTP id 006d021491bc7-6d290b10a35so204070eaf.2
        for <git@vger.kernel.org>; Fri, 30 Oct 2026 03:52:56 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793357575; x=1793962375; darn=vger.kernel.org;
        h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
         :subject:date:from:references:in-reply-to:message-id:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=eFasx2F2M8RCxA7v4JWIW0/D8AW3uMa5Y/Vs8OvI1A8=;
        b=l4U7ZnTFCokoMf4dM4OTrejCvUNp4boaJfO5wqnaPebvFigA6oABQxt3dOyVNaq4Vz
         UuEJu4/LVpYUm+ja+ZebWJoxAuDQkVVDSodZnlT5AReNTYtmfie1llDfU0TJXNCjxScp
         OsFXEt6Ka340foj81lk9ArFixNsUncJD+zFsqiQV7svMD1n2RjHCpcHq+f+t1w7omQpM
         KAYYeQZdespXyMHc9U0/c7kuYtUlhCMAG8IeBTNRYYPb5BCgjJtIJeeP5vwwEQuZY2id
         D3VcB6vuu0guxIcTefSI9ZTAP+cEua99/NNAIPJ6vk1PI5kIkD1uYjtqpiD/zZPPMYeM
         MetQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793357575; x=1793962375;
        h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
         :subject:date:from:references:in-reply-to:message-id:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=eFasx2F2M8RCxA7v4JWIW0/D8AW3uMa5Y/Vs8OvI1A8=;
        b=zrtQ09/F1AJsgBW+iXB1RAOY7950FNrGhZjUfj3EenVqSucpaR12LpAVYy+qtVEqSY
         BMd3E/fQtYjsjCDLNufsxqU3kYGKwFjqrjagpiJg7FP+hkQg+O0LFniEWPAkNDCX2d9v
         /QwBEX9PuVMQqidHe0NObt5ls0G/IPCMJ86Nas9bFvjkPqqUnbccXq37242Bg+IbGS9L
         euggUt11Yt7F87lp1LQz4GvS9GWuw9xKKHy9xO2yaEEeE5B0tKh13lmy+IERHtCy8+cr
         eRZs7v1vco8rmCEJ/wuTsZVl+2fofEEQj5nZAN0P76f1oV5P5PPnA0iCau1fqUnTIM7g
         aKtQ==
X-Gm-Message-State: AFq9FYKWRSo6cOkB25oFK6ib1bY10Prngg7/j4hw/MkoKYVVcNMxRooQ
	JGxw3jPHgNySMKIqGLaTSNobhJ7vmh5NOwDglpjO87afCDfB684ykZAzi7FI+zT3cKM=
X-Gm-Gg: AYBFou1sip5AWyKX0l0yagI9vx5JDtDsE8+pQZDTTOldsDeC3EAlZ7Rdc5GcOzO/kUu
	SU3s7/9IGKOE4Mp/Rd0y/utMuhfh74dxxXIM/7IvclQ0RFKjeOyJpL5CmdM16Bu+kbXlaXjcWWJ
	Pmzr323uNbvwT3nIBaoaC6aWi28+IRbtIX8T+B7Xgr9k5gPAgKmmlZFw5Mcv7XfRMOys0rVFpvM
	P5CjLS59egt226XqdI9caaRYt1MrZd9UX8AR5FSsu0OHGe8i9j0XIbqiwGKCcOGJsyFpGDyhrpp
	JA5pH0fVfR+nDjGoJqylmmZCqPQcDPlQZ/ijKLW8qi67UMM2+aL/XH505+RzB5qt0inRpc3dd28
	4zIk6CKsP9l6fI8S/4hfTj11yhntfrdXPZsEuvIuEuECUFxnJQ6VUfW84vtRRLmFhHkQzlkzr3p
	FrYuL+AcM0fkj5FKL3wYk28yCraVEB0FL63Dolm+T7jzujiCgVSzoDqxBvvjjcgkHfQDgTZBgqh
	wL17isqHGhN7xuzZy3avHfPpFoasubTfcCGU4+MsrI3USJzliXAZlxJus5UCDHxdWCPHZ1xykMu
	NZsKxlmwJVrOyNwV9MWEDAJqPGi4GnlKMJqgDnZeaUBxVfoyjMY=
X-Received: by 2002:a05:6820:1501:b0:70b:638d:4bae with SMTP id 006d021491bc7-714f29cb295mr1207876eaf.46.1793357575258;
        Fri, 30 Oct 2026 03:52:55 -0700 (PDT)
X-Received: from [127.0.0.1] ([20.29.38.98])
        by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4a90af650a1sm1454447fac.15.2026.10.30.03.52.52
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 30 Oct 2026 03:52:53 -0700 (PDT)
X-In-Reply-To: <pull.2412.v13.git.git.1793357550.gitgitgadget@gmail.com>
X-Fcc: Sent
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-Cc: Phillip Wood <phillip.wood123@gmail.com>,
    "D. Ben Knoble" <ben.knoble@gmail.com>,
    Harald Nordgren <haraldnordgren@gmail.com>,
    Harald Nordgren <haraldnordgren@gmail.com>