git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Fetch missing submodule objects from default remote

From
Jacob Keller <jacob.keller@gmail.com>
Date
Jan 13, 2026, 02:17 UTC
Message-ID
<CA+P7+xoqOnU+H_jRq64AsT-Jk058ZTk5M8gpEjREaq799oRHWQ@mail.gmail.com>
In-Reply-To
<20260112213612.2761854-1-nasser.grainawi@oss.qualcomm.com>

On Mon, Jan 12, 2026 at 1:36 PM Nasser Grainawi <nasser.grainawi@oss.qualcomm.com> wrote:

Show 34 quoted lines
>
> When be76c2128234d94b47f7087152ee55d08bb65d88 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>
> ---
> The original commit was a bit over 7 years ago, so I guess it worked
> fine for most users. I've now run into cases where it doesn't work while
> using 'repo' tool manifests that use a non-"origin" remote name and
> contain projects with submodules.
>
> I kept this as a single commit because most of the code delta is in the new
> test for the new submodule helper command, but it could easily be split into
> two commits if that's preferred.
>
>  builtin/submodule--helper.c             |  38 +++++
>  submodule.c                             |  17 ++-
>  t/meson.build                           |   1 +
>  t/t5526-fetch-submodules.sh             |  52 +++++++
>  t/t5572-pull-submodule.sh               |  21 ++-
>  t/t7425-submodule-get-default-remote.sh | 186 ++++++++++++++++++++++++
>  6 files changed, 312 insertions(+), 3 deletions(-)
>  create mode 100755 t/t7425-submodule-get-default-remote.sh
>

I've had this exact same issue due to setting a default name of upstream instead of origin due to how I like to name things for fork-based workflows. The change looks good and the tests are appreciated.

I recall trying to fix related issues with the following series, but I think I lost track of its development and never saw it through to merging:

https://lore.kernel.org/git/20250623-jk-submodule-helper-use-url-v4-0-133ef3d89569@gmail.com/

Reading through that series, it doesn't fix this particular hard coding either, so this is an improvement regardless.

Reviewed-by: Jacob Keller <jacob.keller@gmail.com>
Previous: Nasser GrainawiNext: Ben Knoble
Message 2 of 36 in “Fetch missing submodule objects from default remote”
  1. Fetch missing submodule objects from default remoteNasser Grainawi, Jan 12, 2026
  2. Jacob KellerJan 13, 2026
  3. Ben KnobleJan 13, 2026
  4. Nasser GrainawiJan 13, 2026
  5. D. Ben KnobleJan 14, 2026
  6. Junio C HamanoJan 14, 2026
  7. Ben KnobleJan 14, 2026
  8. Junio C HamanoJan 14, 2026
  9. Nasser GrainawiJan 14, 2026
  10. submodule: fetch missing objects from default remoteNasser Grainawi, Jan 14, 2026
  11. Nasser GrainawiJan 21, 2026
  12. submodule: fetch missing objects from default remoteNasser Grainawi, Jan 22, 2026
  13. Junio C HamanoJan 22, 2026
  14. Jacob KellerJan 22, 2026
  15. Junio C HamanoJan 22, 2026
  16. Junio C HamanoFeb 25, 2026
  17. Jacob KellerMar 2, 2026
  18. Nasser GrainawiFeb 27, 2026
  19. Junio C HamanoJan 22, 2026
  20. Junio C HamanoJan 23, 2026
  21. Junio C HamanoJan 24, 2026
  22. Junio C HamanoFeb 20, 2026
  23. Nasser GrainawiFeb 27, 2026
  24. submodule: fetch missing objects from default remoteNasser Grainawi, Mar 1, 2026
  25. Jacob KellerMar 2, 2026
  26. Junio C HamanoMar 2, 2026
  27. Junio C HamanoMar 3, 2026
  28. Nasser GrainawiMar 3, 2026
  29. Nasser GrainawiMar 3, 2026
  30. Junio C HamanoMar 3, 2026
  31. submodule: fetch missing objects from default remoteNasser Grainawi, Mar 3, 2026
  32. Ramsay JonesMar 3, 2026
  33. Junio C HamanoMar 3, 2026
  34. Nasser GrainawiMar 3, 2026
  35. submodule: fetch missing objects from default remoteNasser Grainawi, Mar 3, 2026
  36. Junio C HamanoMar 9, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.