Skip to content

Commit d008a21

Browse files
committed
fix(pm): retain index ownership in dependency selection
1 parent e6050b7 commit d008a21

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

src/build/prepare.cppm

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,14 +2229,21 @@ prepare_build(bool print_fingerprint,
22292229
};
22302230

22312231
auto xpkgLuaMatchesCandidate =
2232-
[](const mcpp::pm::DependencyCoordinate& coord,
2233-
std::string_view luaContent,
2234-
bool allowLegacyBareDefault) {
2232+
[&](const mcpp::pm::DependencyCoordinate& coord,
2233+
std::string_view luaContent,
2234+
bool allowLegacyBareDefault) {
22352235
// Single source of truth: the descriptor identity gate lives in
2236-
// mcpp.manifest and is shared with the read_xpkg_lua family.
2236+
// mcpp.manifest and is shared with the read_xpkg_lua family. A
2237+
// descriptor served by a declared project index inherits that
2238+
// index's namespace when package.namespace is omitted; preserve
2239+
// the same owner context during this second, stricter check.
2240+
const auto route = index_route();
2241+
const auto* owner = route.find_for_ns(coord.namespace_);
2242+
const std::string_view ownerNs = owner
2243+
? std::string_view{owner->name} : std::string_view{};
22372244
return mcpp::manifest::xpkg_lua_identity_matches(
22382245
luaContent, coord.namespace_, coord.shortName,
2239-
allowLegacyBareDefault);
2246+
allowLegacyBareDefault, ownerNs);
22402247
};
22412248

22422249
auto dependencyCoordinates =

0 commit comments

Comments
 (0)