]> git.ipfire.org Git - thirdparty/git.git/commit
submodule: fetch missing objects from default remote
authorNasser Grainawi <nasser.grainawi@oss.qualcomm.com>
Tue, 3 Mar 2026 23:40:44 +0000 (15:40 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Mar 2026 02:00:43 +0000 (18:00 -0800)
commit3b5fb32da836f5aead1cef319bc3e0a9b975ea35
tree6b21ac32451adcd65ae382f4be021a52c08bc217
parent1faf5b085a171f9ba9a6d7a446e0de16acccb1dc
submodule: fetch missing objects from default remote

When be76c21282 (fetch: ensure submodule objects fetched, 2018-12-06)
added support for fetching a missing submodule object by id, it
hardcoded the remote name as "origin" and deferred anything more
complicated for a later patch. Implement the NEEDSWORK item to remove
the hardcoded assumption by adding and using a submodule helper subcmd
'get-default-remote'. Fixing this lets 'git fetch --recurse-submodules'
succeed when the fetched commit(s) in the superproject trigger a
submodule fetch, and that submodule's default remote name is not
"origin".

Add non-"origin" remote tests to t5526-fetch-submodules.sh and
t5572-pull-submodule.sh demonstrating this works as expected and add
dedicated tests for get-default-remote.

Signed-off-by: Nasser Grainawi <nasser.grainawi@oss.qualcomm.com>
Reviewed-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/submodule--helper.c
submodule.c
t/meson.build
t/t5526-fetch-submodules.sh
t/t5572-pull-submodule.sh
t/t7426-submodule-get-default-remote.sh [new file with mode: 0755]