🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #1451

Re: [RFC PATCH] submodule: make '^/' work like '../' but with an absolute path

#1451
From: Stanislav Aleksandrov
Date: Sun, 25 Oct 2026 21:25
76 lines
13971 bytes
On Sun, Oct 25, 2026 at 12:42 PM Jacob Keller
<jacob.keller@gmail.com> wrote:
> On Tue, Sep 29, 2026 at 11:51 AM Stanislav Aleksandrov
> <lightofmysoul@gmail.com> wrote:
>> - Why not url.<base>.insteadOf? It has to be set up on every clone;
>>   .gitmodules cannot carry it.
>
> Could .gitmodules be extended to carry this information?

Not as a rewrite rule. A rule maps one fixed prefix to another, and
.gitmodules is the same for everyone, so it can't send one person over
https and another over ssh with their own host alias. What differs per
clone is the superproject's remote URL, and that's what "../" and "^/"
resolve against.

We could add a separate "same server as the superproject" key next to
an absolute URL and then Git would ignore the host written in that
URL, but that would be really confusing.

>> - Compatibility: a local "^/..." path needs a "^" directory in the
>>   superproject and protocol.file.allow=always, and "git submodule
>>   add" refuses it.
>
> What do you mean here by "refuses it" Is this character already
> refused? I.e. "^" isn't considered a valid directory, which is why its
> suitable for converting to a special meaning?

No, "^" is a valid directory name, and today "^/org/lib.git" means a
repository in a "^" directory of the superproject. By "refuses" I
meant that "git submodule add" rejects it, as it does "foo/lib.git":

  fatal: repo URL: '^/org/lib.git' must be absolute or begin with ./|../

So such a URL has to be written into .gitmodules by hand or with "git
submodule set-url", and since 2.38.1 it can't be cloned without
protocol.file.allow=always. It is possible, just very unlikely.

> The ultimate goal would be to allow users to specify what protocol
> they want to operate on.

Relative URLs already do that: a superproject cloned over ssh gets its
"../" submodules over ssh too. The problem is that they also follow
where the superproject lives.

> I guess "insteadOf" even in the .gitmodules wouldn't work because you
> wouldn't want to apply that to everyone. The issue seems to be caused
> because of the URLs on Gitlab changing such that relative paths don't
> work anymore?

The URLs don't change. Forks are the problem. A fork lives in another
namespace, and on GitLab often at a different depth, because groups
can be nested.

> Does doing something like "../../" work to allow the subproject to
> find the root from a relative path? Or does the current logic not
> support multiple ".."?

Multiple ".." work, but the count has to match how deep the
superproject is. Let's say the upstream is https://gitlab.com/org/super.git
and lib is https://gitlab.com/org/lib.git:

  - "../lib.git" gives me/lib.git for a fork at me/super.git, which
    only exists if lib was forked too.
  - "../../org/lib.git" works for me/super.git, but gives
    group/org/lib.git for a fork at group/team/super.git.
  - "../../../org/lib.git" works for group/team/super.git, but for
    me/super.git it climbs past the root and eats the host:
    https://org/lib.git.

"^/org/lib.git" gives https://gitlab.com/org/lib.git for all of them,
or git@gitlab.com:org/lib.git if the superproject was cloned over ssh.

On GitHub every repository is two levels deep, so "../../org/lib.git"
works for everyone. GitLab and plain SSH servers have no fixed
depth.
Technical Details
Message-ID: <20261025212517.479922-1-lightofmysoul@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-73223-linux-kernel-git=dewy.ru
References: <20260929185122.3127574-1-lightofmysoul@gmail.com> <CA+P7+xoSd2rsHpw+n5vCrcqXRibG6zH+SKCsVXA0OW-VZN_+=g@mail.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-73223-linux-kernel-git=dewy.ru
From: lightofmysoul@gmail.com (Stanislav Aleksandrov)
Newsgroups: linux.kernel.git
Subject: Re: [RFC PATCH] submodule: make '^/' work like '../' but with an absolute path
Date: Sun, 25 Oct 2026 21:25:17 +0000
Organization: Usenet Network
Message-ID: <20261025212517.479922-1-lightofmysoul@gmail.com>
References: <20260929185122.3127574-1-lightofmysoul@gmail.com> <CA+P7+xoSd2rsHpw+n5vCrcqXRibG6zH+SKCsVXA0OW-VZN_+=g@mail.gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1139770"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:LR067VFgqxj1o1p46VpaHrots58= sha256:4tvigVEz8zNH+AZnVbc97Arom3SWgwtVA2O9764sgy8=
	sha1:nzpSFBDQv0YN7P34i3PdGFjBY6U= sha256:w8zLisnhF3wEs1oUiBVVwHp6mpxpqH19QyN/Bs4WF5E=
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 C2A1E125B72; Mon, 26 Oct 2026 00:26:23 +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 NPvEAwjjrjpB;
	Mon, 26 Oct 2026 00:26:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-73223-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 5A656125B6E; Mon, 26 Oct 2026 00:26:04 +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 32BB12F9D7; Sun, 25 Oct 2026 21:26:00 +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=1792963560;
	b=HnRrD+uKvnehFD8Uo0qlT46GPmpckcweOyWPVxOVIfdC+Fpn9p4gLGMWlGWBm8aKF4N7
	 TjbqewWzXUyvVGtf3L36fIlyJUuV7L/KufvwQbLuTII3+L7woZ9YxC3RXwB4wU2lkkLus
	 onmXSzI0bIblXvWfsQVXvt4u7LMsbojMcQfGyq7FzUQCzchHk5BM5xhbGwM+krWuFjalF
	 23B14fpUoPNCPSVpEhqQv2MbaLBVuHCvXIfxeLSTiFgeDaBPPaEB1E1vytEUawnWJ0+R5
	 58KWZPWb9cFXdhy/5VeU2fQeTQsm8TFqg/EGn6NblUOp22R4fw69146VYzqtqx7Mexg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792963560;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=5tO3PHykZDQxU8F6I4Mt5DUYu2xQKml7DY4mAkgKmi0=;
	b=XrX4ybmzu0tu+vGAZawi1J4O/rYkMolDlGuMyFOkouD+J75+0NRGJ/DAq5UuKx4cCsR+
	 3yteiAdYoieRqHDhXH+KaZHAxFY3hKqaz2TcFB5PRXIGhd20l252ULgPkQDEt7x1t3aJw
	 OFLEm27c4xuguNZkPVktlirQLYS1LMfDTCpV3k2YINOP9imO4/tOakh2PT51kGF4UOa9B
	 POnLpnNThxghgVRnlehabIr5X1PL8M3+9bQUYhquTZo+q6t1DBENcc4ZC1UlzvT09EF1r
	 v98S/IYfHuVS7QEXofWA2UOmE6zICUXsZQrgrrPhMUkA7TmLBtS4I7aV2Ud+hS0LBcQ==
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=20251104 header.b="oS/JySl/";
	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 0A399606A320;
	Sun, 25 Oct 2026 21:26:00 +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=20251104 header.b=oS/JySl/
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.54
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792963559;
	b=Sazn1Q+rj9qWpuwCOq1UTlXTQP/Br0+CsAWhSHIcXhgGyKaPGfgN64a0hlKSJ8wzVT0R
	 kj7YjQlLd0gPWklYq/5GjqyUk2ms2bMQNH4axDCjlI0+Oq5bG2ptecnq6tpFUCpBK4oJj
	 zIt8yJQICYqHK8rQjaeLG0YR/smlrf/+yiqXUHwnLrtQ4azruKPZUi34D5TTFXajdmK1j
	 IgrR1kdxPdxxhKjIC+Z0EKT/odxQOpnt9Kc13ajiDnD0lxzqCKJWEkgzi2/fj5fIr1bLr
	 l4gcvvhd1ck72kcVGP49gbPOxRm3ItBlmYTRB0Y7XA8/2Hxa1B616s/0Ix7UTKjhMGQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792963559;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=5tO3PHykZDQxU8F6I4Mt5DUYu2xQKml7DY4mAkgKmi0=;
	b=iEHAnswLgA1S8bopMl37Qb9I/rKkdMkAJXKVQFZCU/7CCT+W8GnlWtAINpswTfDNG2EM
	 XIZmLi6NN5it1TERowLIR47osfa5bDBC2an6DipBHq3f4BB5J9eE8XBV9i/h1kR5g+KGg
	 rfXKLRyERTlPP3FVwdJFpKHj5/KXs1Y72SDIEUw3ApkmDFtaE0fQfFhpkvepEHgrrlHBB
	 hmM7qmowhTQo1kfrqNz+8Oi1OnCtYLHIK6R5x/jF7PcPM9WZ4Lv10nM4ddF0QHSEWlquz
	 amTup68zkYBGDNxeFYXdzmynF0pz8oN2Ii1umlc8TJ/LzvDfoFdmNksgEjJnoLTn8jQ==
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=20251104 header.b="oS/JySl/";
	arc=none smtp.remote-ip=209.85.128.54
X-Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54])
	(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 C61FE606A328
	for <git@vger.kernel.org>; Sun, 25 Oct 2026 21:25:58 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C61FE606A328
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-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4a218c463d1so13670525e9.0
        for <git@vger.kernel.org>; Sun, 25 Oct 2026 14:25:58 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20251104; t=1792963557; x=1793568357; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=5tO3PHykZDQxU8F6I4Mt5DUYu2xQKml7DY4mAkgKmi0=;
        b=oS/JySl/Wsh68X35IvuWimDOUj5Vz622WuRJWjc2XR41EUrhlv9SBTFywDU/J4T0gA
         /cEJvxc+Z1u9GAiStDJmkiarvoqvI8AEMjnKzNb5JO3cF84dPvoJn9jTY2vAwPsZfAgQ
         tmUbpMgs333fOlyJoHmgWreM/xED7xqzc7pKi9Czb/HV0MtUGJ9Zd/kuhbPbI3dR7C/V
         yyrRnz2SsYXLa32GtdYU/ZGTxNuoO4gyLSK7aZ1wrVwVfmHTmCwLnnFxBglBbk0X+I31
         CDnDGZBpobn4JX/2rhmMz14fqZncnoubBAYpe21hcl8UylG8+VVjzAE3KRpz2lBCU24R
         0OWQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792963557; x=1793568357;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=5tO3PHykZDQxU8F6I4Mt5DUYu2xQKml7DY4mAkgKmi0=;
        b=zAFzuiVfmixxcj04ZzF+EDnCYwFgaiFnYvdHcVsN0YGhsyLp/8QC7iZ9kJdHbnILXC
         ojMMRdP+F5Ju4PawH7F+aihi73HxYbu7nW55mc6qlPmYlIr+iv+vKcWEtJBhsupyEvYH
         zmwppQnBHDReFl1VpxYVGH8a2QGq3jcInEkj44mxbuJCPvaKTxhzdY96B6PtFPf6nJ0F
         QGE5tCXIQCn6Bvn4fMI4oXj0gmss7ANtLLIzY0484ldh5MmxdrVL+AILD7NXKTxcRXJL
         H0odPad1zQ0RkwioU33L4RhQhpIKiv6o2FGVWB4Cky1+bQatu/NfTnUIQ+8azZ9kWRYC
         mgnQ==
X-Gm-Message-State: AFq9FYJ+ahny2mHYEo2J/VdkXVXVFaPnRsEGfvaSA3WLiuED2ZsTrqZt
	mvaAoWsELKFp6w4KvgfD5xZfEFPTmY9zERg7MYegqXJFHJYwzkJzBMIr
X-Gm-Gg: AYBFou2STx/vSMxfcfOucCqA5+v5lYHS3rkG3lw9uFBEvwhIQa+xcQhqIOQ8uVcgVs9
	M073jPGC4iAhiMESNk7zpBiEyJOzqdXr74twVIqkKAjQF7OS7O/gZwG3TLoxOBnzZZnoDhFIcvp
	htI/tOZ5bRDR+epphG8dS/xGXzRaKBIFCue8p6XXnnId34AgC7gsawArqHPmA6ap1LQYKwGV+TD
	dP37BCQrApjW/KUUNDEnzMfCeRIS5hn4s1xtnlO23vqOxoZarGckmgdObaMcIKsmojp6bLNsdd3
	jZ0wTgW0vU9rgmysD4wkkTbpQdBOD7rfc1heJ3JuLlLyf13W/oWPeWklLpO6Zm01kxhKG7ri/CU
	yIwPxDsxOljDPaWycOBTDgEY6AZcXAO+Fd2L/Qjqr9cHgkDogUUmSOzdhvQB/nYVZT2rIRaBq/s
	GBIT53LMVA8ak8QFLf8oFMH7dNhqY9v36+x9SoFHono2mkfATglV5QxvmbMscZof9V68l3A+HR6
	jb4zfH8YNx3vjopKFQBjWgtOg++j0DBq2gQ1iZrxUWhfdZbFAcGHQ==
X-Received: by 2002:a05:600c:19d4:b0:4a2:18d4:f9e0 with SMTP id 5b1f17b1804b1-4a35acbbcaamr85538305e9.25.1792963557068;
        Sun, 25 Oct 2026 14:25:57 -0700 (PDT)
X-Received: from flare5 ([212.58.121.92])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a359fc1207sm114723975e9.1.2026.10.25.14.25.54
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sun, 25 Oct 2026 14:25:55 -0700 (PDT)
X-Cc: git@vger.kernel.org,
	Patrick Steinhardt <ps@pks.im>,
	Adrian Ratiu <adrian.ratiu@collabora.com>,
	Jeff King <peff@peff.net>,
	Junio C Hamano <gitster@pobox.com>
X-Mailer: git-send-email 2.55.0
X-In-Reply-To: <CA+P7+xoSd2rsHpw+n5vCrcqXRibG6zH+SKCsVXA0OW-VZN_+=g@mail.gmail.com>
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