diff --git a/scripts/check-layout.py b/scripts/check-layout.py index 5c55dc8..a4811b0 100644 --- a/scripts/check-layout.py +++ b/scripts/check-layout.py @@ -285,7 +285,7 @@ def check_submodules(config, active, depth, label, urls): for name, fields in sections.items(): require(set(fields) == {"path", "url"}, f"{label}: unexpected submodule settings: " - f"{sorted(f'submodule.{name}.{field}' for field in fields ^ {'path', 'url'})}") + f"{sorted(f'submodule.{name}.{field}' for field in set(fields) ^ {'path', 'url'})}") path = fields["path"] require(path not in by_path, f"{label}: duplicate submodule path: {path}") by_path[path] = fields["url"] diff --git a/tests/integration/test_layout.py b/tests/integration/test_layout.py index c794f5d..cfc74f6 100644 --- a/tests/integration/test_layout.py +++ b/tests/integration/test_layout.py @@ -658,6 +658,15 @@ release = "optional" with self.assertRaisesRegex(ValueError, "invalid submodule URL: cli"): layout.validate("HEAD", False) + def test_accepts_a_submodule_section_name_that_differs_from_its_path(self): + self.root_repo(CLI, {"cli": "a" * 40}, {"cli": CORE_URL}) + self.write(self.root, ".gitmodules", + f'[submodule "core-runtime"]\n\tpath = cli\n\turl = {CORE_URL}\n') + self.stage(self.root) + self.gitlink(self.root, "cli", "a" * 40) + self.git("commit", "-qm", "named section") + layout.validate("HEAD", False) + def test_rejects_a_wrong_domain_root_url(self): self.root_repo(CLI + WEB_DOMAIN, {"cli": "a" * 40, "extensions/web": "b" * 40},