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

[PATCH v4 0/2] fetch: make submodule fetch errors configurable

From
PZPaulius Zaleckas <paulius.zaleckas@gmail.com>
Date
Jul 14, 2026, 13:29 UTC
Message-ID
<20260714132959.3368867-1-paulius.zaleckas@gmail.com>
In-Reply-To
<20260710122655.3066377-1-paulius.zaleckas@gmail.com>

When fetching with --recurse-submodules, git currently exits with a non-zero status if any submodule references an OID that is not reachable from the submodule's remote. This situation arises naturally when an upstream branch is still in preparation (e.g. a topic branch in a merge window): the local branch does not depend on the missing commit, so a hard failure is unnecessarily disruptive.

Patch 1 fixes a pre-existing NEEDSWORK in submodule.c where a phase-1 fetch failure was recorded immediately, even when a phase-2 OID-based retry was about to be scheduled. After this fix the existing fatal behaviour is preserved but the logic is now structured so that errors are only recorded when the phase-2 retry actually fails, or when there is no phase-2 retry to fall back on.

Patch 2 introduces fetch.submoduleErrors (fail|warn) and --submodule-errors=(fail|warn) to let users opt into non-fatal behaviour. The default remains fail for full backwards compatibility.

Changes in v4:
- Forward an explicit --submodule-errors=fail to child fetches as well,
  so the command line overrides fetch.submoduleErrors=warn config in
  the per-remote children of fetch --all/--multiple (noticed by Junio)
Changes in v3:
- Report a phase-1 failure also when the gitlink commits are already
  present locally, instead of silently succeeding
- Route "Could not access submodule" through record_fetch_error() so it
  shows up in the error summary and honors the warn mode
- Forward --submodule-errors to child fetches so it takes effect for
  fetch --all/--multiple and nested submodule recursion
- Add tests for all of the above
- Documentation: don't imply git pull takes --submodule-errors, minor
  wording and placement fixes
Changes in v2:
- Fix option synopsis to use (fail|warn) instead of <fail|warn>
- Add --submodule-errors documentation to Documentation/fetch-options.adoc
Paulius Zaleckas (2):
  submodule: fix premature failure in recursive submodule fetch
  fetch: add fetch.submoduleErrors to make submodule fetch errors
    non-fatal
 Documentation/config/fetch.adoc  |  14 +++
 Documentation/fetch-options.adoc |   8 ++
 builtin/fetch.c                  |  46 ++++++++-
 submodule.c                      |  58 ++++++++---
 submodule.h                      |   7 +-
 t/t5526-fetch-submodules.sh      | 161 +++++++++++++++++++++++++++++++
 6 files changed, 277 insertions(+), 17 deletions(-)
-- 
2.54.0
Previous: Paulius ZaleckasNext: Paulius Zaleckas
Message 6 of 20 in “fetch: make submodule fetch errors configurable”
  1. 0/2 fetch: make submodule fetch errors configurablePaulius Zaleckas, Jul 10, 2026
  2. 1/2 submodule: fix premature failure in recursive submodule fetchPaulius Zaleckas, Jul 10, 2026
  3. 2/2 fetch: add fetch.submoduleErrors to make submodule fetch errors non-fatalPaulius Zaleckas, Jul 10, 2026
  4. Junio C HamanoJul 10, 2026
  5. Paulius ZaleckasJul 14, 2026
  6. 0/2 fetch: make submodule fetch errors configurablePaulius Zaleckas, Jul 14, 2026
  7. 1/2 submodule: fix premature failure in recursive submodule fetchPaulius Zaleckas, Jul 14, 2026
  8. 2/2 fetch: add fetch.submoduleErrors to make submodule fetch errors non-fatalPaulius Zaleckas, Jul 14, 2026
  9. Junio C HamanoJul 14, 2026
  10. Junio C HamanoJul 14, 2026
  11. 0/2 fetch: make submodule fetch errors configurablePaulius Zaleckas, Jul 15, 2026
  12. 1/2 submodule: fix premature failure in recursive submodule fetchPaulius Zaleckas, Jul 15, 2026
  13. 2/2 fetch: add fetch.submoduleErrors to make submodule fetch errors non-fatalPaulius Zaleckas, Jul 15, 2026
  14. Junio C HamanoJul 15, 2026
  15. 0/2 fetch: make submodule fetch errors configurablePaulius Zaleckas, Jul 16, 2026
  16. 1/2 submodule: fix premature failure in recursive submodule fetchPaulius Zaleckas, Jul 16, 2026
  17. 2/2 fetch: add fetch.submoduleErrors to make submodule fetch errors non-fatalPaulius Zaleckas, Jul 16, 2026
  18. Paulius ZaleckasAug 10, 2026
  19. Junio C HamanoAug 26, 2026
  20. Paulius ZaleckasSep 23, 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.