Article View: linux.kernel.git
Article #841Re: [PATCH v1] remote.c: defer remote.<name>.followRemoteHEAD validation
From: "Matt Hunter"
Date: Mon, 19 Oct 2026 21:24
Date: Mon, 19 Oct 2026 21:24
84 lines
11351 bytes
11351 bytes
On Sun Oct 18, 2026 at 7:55 PM EDT, Colin Hinton wrote:
> Continuing from 86129fd (fetch.c: defer fetch.followRemoteHEAD
> validation), apply the same treatment to
> remote.<name>.followRemoteHEAD, which is still validated in
> handle_config(). That emits a warning for any command that loads the
> remote configuration, such as "git push" or "git remote -v", even
> though only "git fetch" ever consults the value.
>
> Store the raw string in struct remote instead, and resolve it lazily
> in do_fetch() through the get_follow_remote_head() helper introduced
> by 86129fd. This replaces the parsed follow_remote_head and
> no_warn_branch members, and the NEEDSWORK comment left behind by
> 86129fd is removed. "git remote set-head" now compares against the
> raw string to decide whether to rewrite "always" to "warn".
>
> Because both settings now go through the same parser,
> fetch.followRemoteHEAD accepts "warn-if-not-<branch>", which
> previously was only recognized for remote.<name>.followRemoteHEAD.
> Document it under fetch.followRemoteHEAD, drop the remote-specific
> paragraph, and add tests for the new fetch-level form.
I think a better justification is needed for this. The intent behind
'warn-if-not-<branch>' makes much less sense in the context of the fetch
variable imo, and if it turns out to be problematic, reverting support
later will be tricky.
See previous discussion:
<20260611060123.GA2187173@coredump.intra.peff.net>
<DJ6IBPYNOTTY.3QKEZQ28P713V@ferdinandy.com>
>
> Messages for an unrecognized or missing value no longer name the
> fetch. prefix, as the helper now serves both the fetch-level and
> the remote-level setting.
I agree with Junio that this should be addressed.
>
> @@ -139,6 +139,9 @@ remove the value for the `fetch.bundleCreationToken` value before fetching.
> `warn`;;
> Display a warning if the remote advertises a different `HEAD` than what is
> set locally. Behaves like "create" if the local symbolic-ref doesn't exist.
> +`warn-if-not-<branch>`;;
> + Like "warn", but do not display the warning if the remote's `HEAD`
> + is `remotes/<name>/<branch>`.
> `always`;;
> Silently update `remotes/<name>/HEAD` whenever the remote advertises a new
> value.
I like the style change from $branch to <branch>
> @@ -1978,14 +1982,10 @@ static int do_fetch(struct transport *transport,
> if (transport->remote->fetch.nr) {
> refspec_ref_prefixes(&transport->remote->fetch,
> &transport_ls_refs_options.ref_prefixes);
> - /*
> - * See remote.c's handling of remote.<name>.followRemoteHEAD
> - * for the analogous, still-unresolved case.
> - */
> - if (transport->remote->follow_remote_head)
> - follow_remote_head = transport->remote->follow_remote_head;
> + if (transport->remote->follow_remote_head_seen)
> + follow_remote_head = get_follow_remote_head(transport->remote->follow_remote_head_raw, &no_warn_branch);
> else if (config->follow_remote_head_seen)
> - follow_remote_head = get_follow_remote_head(config->follow_remote_head_raw);
> + follow_remote_head = get_follow_remote_head(config->follow_remote_head_raw, &no_warn_branch);
A couple more overly-long lines
> else
> follow_remote_head = BUILTIN_FOLLOW_REMOTE_HEAD_DFLT;
> }
By the way, I had previously made a comment about moving the definition
of 'enum follow_remote_head_settings' over to the fetch file since that
is now the only place it is relevant. Do you think it's worth changing?
Technical Details
Message-ID:
<DM94QXU2Y6J7.39IGDUTB5XN1L@lfurio.us>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72457-linux-kernel-git=dewy.ruReferences:
<20261018235508.848-1-colinlewishinton@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-72457-linux-kernel-git=dewy.ru
From: m@lfurio.us ("Matt Hunter")
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v1] remote.c: defer remote.<name>.followRemoteHEAD
validation
Date: Mon, 19 Oct 2026 17:24:30 -0400
Organization: Usenet Network
Message-ID: <DM94QXU2Y6J7.39IGDUTB5XN1L@lfurio.us>
References: <20261018235508.848-1-colinlewishinton@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="3716235"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:LuFu2IoolYZyZpkuq4Np771U2ys= sha256:VKZyJtdMKJsUoWhrhKztOh6fTyC/wMT0pgL02brZc7o=
sha1:NUfSkNug5jkywruU40omZIeKi+Q= sha256:ka5Rokz5rBVVvED4Q2KcVjyuN3cf3WVz8W/3zoFmd08=
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 E0ECC110B40; Tue, 20 Oct 2026 00:27:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.95
X-Spam-Status: No, score=-1.95 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,
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 (1024-bit key)
header.d=lfurio.us
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 hVplkZQ276_l;
Tue, 20 Oct 2026 00:27:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-72457-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lfurio.us
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id 1CCE1110B29; Tue, 20 Oct 2026 00:26:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id C5A4B3E8BB; Mon, 19 Oct 2026 21:24:54 +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=1792445091;
b=iLZTFY2priFeX+Ss9WtukEsr4vlOVNy+elAPqDV+m7W1CEno2pFfKQPcQy33JVKGeaPu
A4MfSczAkZvUI4ReC76cVinkPG0PO0wcRYwWBy45N38+93sR3of0+/G2TeZV3C7QvEfjb
KNS3KC52FblJL2EfnT0+C7z1wGs16d59SUmyNbR2Zt8NDopZcc6Y9JKwxMDZdxb/YGZ+s
0xWAFyluNUHqM8ZEtIjOPqgElk4bqvW9Jn7gP3cyr2uGLilXsiuUftmNmNuWLwNP+SuLe
v1SpNTl4gGFQsFYvp4WwC1/4sfN2bOF2fkEZTy+PVHG72+8uDjRCptTDddMj3dS0+yA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792445091;
h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:
X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:Mime-Version:
Content-Transfer-Encoding:Content-Type:Date:Message-Id:Subject:Cc:To:
From:X-Mailer:References:In-Reply-To;
bh=L3FCo1Z45dyMGJGZ1ZlpCFl6cDGFdSHXkkVomRL0zU8=;
b=KLqvUMYeMku4Kk90nQMer84gfj9ZJgd8th+jDetbD/U6r672cEiOoFcNbZX5Z6+OVmPw
nTpeVep4zc9KMWs3XBYcGkYc4t0Situ4cXJZ/v2SVO+SRztvFgZEsJ1KzomSMeABG5rQ5
BkTTqDrHW5Lm2YO80XpMZLh5nXfdRBWesuvlX11Om9dvaKRkw/AVURMp/9F9uvdxUkGCF
6IHs0O1SfLfPultrpw+9KgNG18APUXxqGKTHMAwvsBfJn0gj6W4vqDdKwPukrzZjBwZxR
YOUOZg6qIpAqCpkSJRJ6qFhyTRYJodfvVSnZTfRs9a8usbDF6vqVOiXmHIrqRonluJQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=lfurio.us header.i=@lfurio.us header.a=rsa-sha256 header.s=default header.b="hjBMH9/9";
dmarc=pass header.from=lfurio.us;
spf=pass smtp.mailfrom=lfurio.us;
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 B39CE606A321;
Mon, 19 Oct 2026 21:24:51 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key, unprotected) header.d=lfurio.us header.i=@lfurio.us header.a=rsa-sha256 header.s=default header.b=hjBMH9/9
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=157.230.60.252
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792445090;
b=1KrigRfPPYWhFE9f/6neVKk0Ho0v3/0ruJrigv8CILBblmg5sURemnIcdZ7KlP6MQPPP
ADLSiDs1si1uzpI2oU8zP3ivb4znU9zr+2Rlhfl5V/RbVPwRpHJfG+iveo7uinS8RR2Hc
g38XVSQsU72scJop3P0lhmWhlyihJGX0fjnuNpr3UlfHSWdgAhT9V5+QSrLib5YVqIES7
VM5j6OYPMWjyf3t0ZNBpz5ky1UrBKZRztwr7uAb2krSh/WLjSv/i+aq4sN8VAEQeM8S9O
HTfiYIEgiXV9YVPRe7sNbDYSQGCOg3OPyZdCRVm033R1ZTHjG+zpEJDnZ0PqA0RTImQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792445090;
h=DMARC-Filter:DKIM-Signature:Received:Mime-Version:
Content-Transfer-Encoding:Content-Type:Date:Message-Id:Subject:Cc:To:
From:X-Mailer:References:In-Reply-To;
bh=L3FCo1Z45dyMGJGZ1ZlpCFl6cDGFdSHXkkVomRL0zU8=;
b=EgUht7nf/6PV2Hc3EvDwu0qyTN14SQGU660hkxRkQG22zHJF0ibSXzqLEFOwuI3oVkLv
lDTXpUCSZ6bCp4jFPDvflnQihhywAPGVQaD1OWsejXxFU02DK5RtHDZhdCLbc1sQdOXMC
cvVLpJhuKSmYgGjjM17mj1bpCr+u20kvW9zKsGyyT7u0P8M39Jr2UiC92sjXU3vA5unzd
K7h0B7ByAtTc2nyzu1qcm8my3hr2VLfzG4JFNMfQxApg2Jt2IYZzjUl46XbqCQ1yRoCSt
Wnt/59nCzV6SWC49ONWM34uVOmKNE03LhaEEpDrnFkbH7Hqx6zfXB45pCM2uV1Yd89A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=lfurio.us;
spf=pass smtp.mailfrom=lfurio.us;
dkim=pass header.d=lfurio.us header.i=@lfurio.us header.a=rsa-sha256 header.s=default header.b="hjBMH9/9";
arc=none smtp.remote-ip=157.230.60.252
X-Received: from mail.normalmode.org (h01.normalmode.org [157.230.60.252])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BE59606A323
for <git@vger.kernel.org>; Mon, 19 Oct 2026 21:24:49 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0BE59606A323
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lfurio.us
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lfurio.us
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lfurio.us; s=default;
t=1792445083; bh=i9yYuQ12cjOjEJmEBMlfCzDyxM65NrSrhuSFsPXW8ig=;
h=Date:Subject:Cc:To:From:References:In-Reply-To:From;
b=hjBMH9/9vbecf5Wm0j5MKQ2HYWzHiz0fZwUK8UgXaeLhzSEWCE1r6J+wyaOiin0KD
r21On7b/Wd8600W5wzRfrVcILk6JycKypDXeEPXo4QTbn9BtSY2/C5kUlNbwHFsUGO
uQdlSVtKjwdB+M5IldPrBonQsBp7UUGRk3k13dxk=
X-Received: by mail.normalmode.org (Postfix) with ESMTPSA id 20BAB6225B;
Mon, 19 Oct 2026 21:24:43 +0000 (UTC)
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: <gitster@pobox.com>
X-Mailer: aerc 0.21.0-0-g5549850facc2
X-In-Reply-To: <20261018235508.848-1-colinlewishinton@gmail.com>