Commit 2dbd1c8
submodule: resolve insteadOf aliases when matching remote
When ca62f52 (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>1 parent 9a0c470 commit 2dbd1c8
2 files changed
Lines changed: 30 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1821 | 1821 | | |
1822 | 1822 | | |
1823 | 1823 | | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
1824 | 1827 | | |
| 1828 | + | |
| 1829 | + | |
1825 | 1830 | | |
1826 | 1831 | | |
1827 | 1832 | | |
1828 | 1833 | | |
1829 | 1834 | | |
1830 | 1835 | | |
1831 | | - | |
1832 | | - | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
1833 | 1840 | | |
1834 | | - | |
| 1841 | + | |
| 1842 | + | |
1835 | 1843 | | |
1836 | 1844 | | |
1837 | 1845 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
259 | 278 | | |
260 | 279 | | |
261 | 280 | | |
| |||
0 commit comments