When a submodule URL changes in .gitmodules, the URL cached in the
superproject's .git/config can remain stale. This change makes git status
report the mismatch and suggest git submodule sync.
Relative URLs are resolved as git submodule sync resolves them. For
populated submodules, the check follows the remote that git submodule sync
would update. Local remote customizations are respected so the advice does
not suggest overwriting them.
The warning is written to standard error for long, short, and porcelain
formats, follows pathspecs, and is suppressed by --ignore-submodules=all.
Closes gitgitgadget/git#565
Alessio Attilio (4):
submodule: share repository-aware URL resolution
status: warn about submodule URL mismatches
status: preserve customized submodule remotes
status: test submodule URL warnings
Documentation/git-status.adoc | 12 +++
builtin/commit.c | 1 +
builtin/submodule--helper.c | 60 ++-------------
submodule.c | 45 +++++++++++
submodule.h | 12 +++
t/t7508-status.sh | 121 ++++++++++++++++++++++++++++++
wt-status.c | 136 ++++++++++++++++++++++++++++++++++
wt-status.h | 1 +
8 files changed, 335 insertions(+), 53 deletions(-)
base-commit: 566b6997dd4710b625c0882cf10a7443bf52d183
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2509%2Fkairosci%2Ftopic%2Fstatus-submodule-url-sync-v6
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2509/kairosci/topic/status-submodule-url-sync-v6
Pull-Request: https://github.com/git/git/pull/2509
Range-diff vs v5:
1: 35d9d09ebe = 1: 35d9d09ebe submodule: share repository-aware URL resolution
2: 6db7dc9415 ! 2: 123289e0f9 status: warn about submodule URL mismatches
@@ Metadata
## Commit message ##
status: warn about submodule URL mismatches
- When a user changes a URL in .gitmodules, the cached URL in .git/config
- can remain stale and status looks clean. Compare active declarations
- with cached URLs while printing status; honor pathspec and ignore options.
+ When a user changes a URL in .gitmodules, the cached URL in
+ .git/config can remain stale. Compare the URL declared in
+ .gitmodules with the cached superproject URL, then compare both
+ against the submodule's selected remote URL. Warn only when the
+ submodule remote matches neither URL, since that indicates syncing
+ will not overwrite a local customization.
+
+ Emit the warning on standard error for long, short, and porcelain
+ status formats. Respect pathspecs and suppress the warning when
+ submodules are ignored.
Signed-off-by: Alessio Attilio <atti…@protonmail.com>
3: d80542df12 = 3: 69aed73e23 status: preserve customized submodule remotes
4: ec282a2a6c = 4: bceb173f58 status: test submodule URL warnings
--
gitgitgadget