]> git.ipfire.org Git - thirdparty/git.git/commit
submodule: resolve insteadOf aliases when matching remote
authorÉric NICOLAS <ccjmne@gmail.com>
Thu, 23 Jul 2026 00:21:32 +0000 (02:21 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Jul 2026 03:24:21 +0000 (20:24 -0700)
commit2dbd1c85e12d3329bda20fa2ff049d3083522237
treec63a6cc542e12b2494851284b89013bdc19bfc9d
parent9a0c4701dcd5725c4184599322b52933ff5005ca
submodule: resolve insteadOf aliases when matching remote

When ca62f524c1 (submodule: look up remotes by URL first, 2025-06-23)
introduced a mechanism to identify which remote is to be used by a
submodule, it compared the URL stored in the .gitmodules inventory to
that of each available remote.

The URLs of remotes are rewritten according to url.<base>.insteadOf,
whereas those stored in the .gitmodules aren't.  When such aliasing
applies, no match can be made between the two corresponding sides, and
the procedure degrades to its fallback logic electing either the only
configured remote if there is only one, or "origin" otherwise.

That behaviour is unfortunate when no remote is called "origin",
because its last resort will have a submodule update command look for a
non-existent remote-tracking reference and fail to proceed, instead of
using the remote whose rewritten URL matches.

Resolve the alias in the URL inventoried in .gitmodules before comparing
it against those of the corresponding submodule's configured remotes.

Signed-off-by: Éric NICOLAS <ccjmne@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c
t/t7406-submodule-update.sh