Subject: Re: [PATCH v4] submodule: fetch missing objects from default remote

From: Junio C Hamano <[email-masked]>
Date: Mon, 02 Mar 2026 18:11:41 -0800

Nasser Grainawi <[email-masked]> writes:

> 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 <[email-masked]>
> ---
> I removed Jacob Keller's Reviewed-By since there are more significant
> edits to the tests in v4 that they haven't reviewed.
>
> v4 includes fixes for the issues Junio patched in seen and I confirmed
> it merges cleanly to seen (with v3 reverted) as well as next and passes
> tests.

The tests in this patch seems to be broken.  I didn't notice it
before merging it to 'seen', so tonight's integration CI is expected
to fail at the tip of 'seen'.

*** prove (shell & unit tests) ***
[18:10:13] t5526-fetch-submodules.sh .. 39/? 
	error: bug in the test script: test_when_finished does nothing in a subshell
[18:10:13] t5526-fetch-submodules.sh .. 42/?
	error: bug in the test script: test_when_finished does nothing in a subshell
[18:10:13] t5526-fetch-submodules.sh .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 2/56 subtests 
[18:10:28]

Test Summary Report
-------------------
t5526-fetch-submodules.sh (Wstat: 256 (exited 1) Tests: 56 Failed: 2)
  Failed tests:  40, 44
  Non-zero exit status: 1