From: ATTILIO ALESSIO Date: Fri, 27 Nov 2026 20:35:29 GMT Subject: Re: [PATCH v2 2/2] status: warn about stale submodule URLs Message-ID: In-Reply-To: "Junio C Hamano" 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(). > 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. > - Should "git status " 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 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