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

Re: [PATCH v2 2/2] status: warn about stale submodule URLs

From
AAATTILIO ALESSIO <attilio.alessio@protonmail.com>
Date
Nov 27, 2026, 20:35 UTC
Message-ID
<OMY1zvJHIGS8yvryfUhct_Q4HkqQNP3QJ0ezjSIY6F5k_L5UpMLJ0B31C5LUjJwglnYlccCCh1WVqawRDXMUQXPX9FgsxWFwrcS5HUGaZ_4=@protonmail.com>
In-Reply-To
<xmqqecc69maa.fsf@gitster.g>
"Junio C Hamano" <gitster@pobox.com> writes:
> It would help to explain in the proposed log message why three URLs are
> compared and under what condition, and which status formats emit the
> warning.

Will do. I will explain in the commit message why the three URLs are compared, under what condition the warning triggers, and which status formats emit it.

> Perhaps move the unnecessary call to repo_default_remote() after this
> early return, before the first use of 'remote'?

Good catch. I will move repo_default_remote() below the early return for non-relative URLs.

> Perhaps use repo_config_get_string_multi() instead?  I do not know what
> error behavior you are aiming for here, but the 'string' variant would
> barf on an entry like '[remote "origin"] url' (valueless true), which
> would give you NULL in the '.string' member.

Agreed. I will switch to the *_get_string*() helpers (or guard against valueless entries) so we never pass NULL to strcmp().

Show 5 quoted lines
> In order to match what sync_submodule() does, 'gitmodules_remote_url'
> should be computed from the raw 'sub->url', not from 'gitmodules_url',
> no?  For 'config_remote_url', we do not want to run relative_url() again
> on 'config_url', I think.  You only need to prepend 'up_path', or
> something, no?

You are right: the values passed to submodule_has_custom_remote_url() have already been resolved once, so resolving them again produces wrong paths when the superproject's own remote URL is relative. I will rework this to resolve the raw .gitmodules URL and prepend up_path to the cached config URL, matching git submodule sync.

> Instead of excluding individual cases (like "commit or history can call
> and .commit_template or .nowarn may be set by them"), can we make sure
> we call the extra check only when "git status" is calling the wt-status
> machinery to prevent it?

Yes, gating the check so it runs only when invoked from git status is much cleaner and avoids leaking warnings into commit templates.

Show 13 quoted lines
> - Should "git status <pathspec>" limit its check to submodules under
>    the given directory?
>
> - Should "git status --ignore-submodules" bypass the new check
>    altogether?
>
> - Should "git status -s" and "git status --porcelain" detect the
>    misconfiguration like the normal "git status"?
>
> My tentative answers to the above are all "yes", but the design needs to
> be discussed, the choices justified, and the result documented in both
> the proposed commit log message and in the "git status --help"
> documentation.
I agree with "yes" on all three:
- Respecting <pathspec> keeps the warning scoped to the paths the user
  asked about.
- Respecting --ignore-submodules matches user expectations when they
  explicitly ask status to ignore submodule state.
- Emitting the warning on stderr in -s and --porcelain modes ensures
  users and scripts still get the diagnostic without affecting machine-
  readable stdout output.

I will update the implementation, tests, commit message, and git-status documentation accordingly for the next reroll.

Thanks, Alessio

Previous: Junio C HamanoNext: D. Ben Knoble
Message 7 of 26 in “status: warn about stale submodule URLs”
  1. status: warn about stale submodule URLsAlessio Attilio via GitGitGadget, Nov 27, 2026
  2. D. Ben KnobleNov 27, 2026
  3. 0/2 status: report when submodule URLs are out of syncAlessio Attilio via GitGitGadget, Nov 27, 2026
  4. 1/2 submodule: prepare URL helpers for reuseAlessio Attilio via GitGitGadget, Nov 27, 2026
  5. 2/2 status: warn about stale submodule URLsAlessio Attilio via GitGitGadget, Nov 27, 2026
  6. Junio C HamanoNov 27, 2026
  7. ATTILIO ALESSIONov 27, 2026
  8. D. Ben KnobleNov 30, 2026
  9. 0/2 status: report when submodule URLs are out of syncAlessio Attilio via GitGitGadget, Nov 27, 2026
  10. 1/2 submodule: prepare URL helpers for reuseAlessio Attilio via GitGitGadget, Nov 27, 2026
  11. Junio C HamanoNov 28, 2026
  12. 2/2 status: warn about stale submodule URLsAlessio Attilio via GitGitGadget, Nov 27, 2026
  13. Junio C HamanoNov 28, 2026
  14. Junio C HamanoNov 28, 2026
  15. 0/3 status: report when submodule URLs are out of syncAlessio Attilio via GitGitGadget, Nov 28, 2026
  16. 1/3 submodule: move URL helpers into submodule.cAlessio Attilio via GitGitGadget, Nov 28, 2026
  17. D. Ben KnobleNov 30, 2026
  18. 2/3 submodule: make URL resolution repository-awareAlessio Attilio via GitGitGadget, Nov 28, 2026
  19. D. Ben KnobleNov 30, 2026
  20. 3/3 status: report when submodule URLs are out of syncAlessio Attilio via GitGitGadget, Nov 28, 2026
  21. Junio C HamanoNov 29, 2026
  22. 0/4 status: report when submodule URLs are out of syncAlessio Attilio via GitGitGadget, Dec 1, 2026
  23. 1/4 submodule: share repository-aware URL resolutionAlessio Attilio via GitGitGadget, Dec 1, 2026
  24. 2/4 status: warn about submodule URL mismatchesAlessio Attilio via GitGitGadget, Dec 1, 2026
  25. 3/4 status: preserve customized submodule remotesAlessio Attilio via GitGitGadget, Dec 1, 2026
  26. 4/4 status: test submodule URL warningsAlessio Attilio via GitGitGadget, Dec 1, 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.