diff options
| author | Gavin Mak <gavinmak@google.com> | 2026-01-14 22:14:28 +0000 |
|---|---|---|
| committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2026-01-15 10:27:32 -0800 |
| commit | 3c0e67bbc5f7c3849919735db4bfd7e66190f80c (patch) | |
| tree | 70298691b368bfe0b6fffbb03e76e425440cbbb3 /tests | |
| parent | 3b7b20ac1d3abe7d2ac37e2040326aa1051b1336 (diff) | |
| download | git-repo-3c0e67bbc5f7c3849919735db4bfd7e66190f80c.tar.gz | |
manifest_xml: prevent extend-project from inheriting local groups
When extending a project in a local manifest, the project inherits the
`local:` group. This causes the superproject override logic (which omits
projects with `local:` groups) to incorrectly exclude the project from
the override manifest. This leads to "extend-project element specifies
non-existent project" errors during sync reload.
Fix this by stripping `local:` groups from extended projects, ensuring
they remain visible to superproject overrides while still allowing other
inherited groups to persist.
Bug: 470374343
Change-Id: I1a057ebffebc11a19dc14dde7cc13b9f18cdd0a3
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/543222
Reviewed-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Reviewed-by: Mike Frysinger <vapier@google.com>
Tested-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_manifest_xml.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index 039921f65..97fea3da3 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py | |||
| @@ -549,6 +549,33 @@ class IncludeElementTests(ManifestParseTestCase): | |||
| 549 | # Check project has set group via extend-project element. | 549 | # Check project has set group via extend-project element. |
| 550 | self.assertIn("eg1", proj.groups) | 550 | self.assertIn("eg1", proj.groups) |
| 551 | 551 | ||
| 552 | def test_extend_project_does_not_inherit_local_groups(self): | ||
| 553 | """Check that extend-project does not inherit local groups.""" | ||
| 554 | root_m = self.manifest_dir / "root.xml" | ||
| 555 | root_m.write_text( | ||
| 556 | """ | ||
| 557 | <manifest> | ||
| 558 | <remote name="test-remote" fetch="http://localhost" /> | ||
| 559 | <default remote="test-remote" revision="refs/heads/main" /> | ||
| 560 | <project name="project1" path="project1" /> | ||
| 561 | <include name="man1.xml" groups="g1,local:g2" /> | ||
| 562 | </manifest> | ||
| 563 | """ | ||
| 564 | ) | ||
| 565 | (self.manifest_dir / "man1.xml").write_text( | ||
| 566 | """ | ||
| 567 | <manifest> | ||
| 568 | <extend-project name="project1" groups="g3" /> | ||
| 569 | </manifest> | ||
| 570 | """ | ||
| 571 | ) | ||
| 572 | include_m = manifest_xml.XmlManifest(str(self.repodir), str(root_m)) | ||
| 573 | proj = include_m.projects[0] | ||
| 574 | |||
| 575 | self.assertIn("g1", proj.groups) | ||
| 576 | self.assertNotIn("local:g2", proj.groups) | ||
| 577 | self.assertIn("g3", proj.groups) | ||
| 578 | |||
| 552 | def test_allow_bad_name_from_user(self): | 579 | def test_allow_bad_name_from_user(self): |
| 553 | """Check handling of bad name attribute from the user's input.""" | 580 | """Check handling of bad name attribute from the user's input.""" |
| 554 | 581 | ||
