aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--crates/mozart-core/src/package.rs7
-rw-r--r--crates/mozart/tests/installer.rs5
2 files changed, 8 insertions, 4 deletions
diff --git a/crates/mozart-core/src/package.rs b/crates/mozart-core/src/package.rs
index ce2ff12..5906c7e 100644
--- a/crates/mozart-core/src/package.rs
+++ b/crates/mozart-core/src/package.rs
@@ -458,6 +458,7 @@ delegate_complete_package!(RootPackageData => complete);
/// and map directly to the JSON keys via serde.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RawPackageData {
+ #[serde(default = "default_root_package_name")]
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
@@ -531,6 +532,12 @@ pub struct RawRepository {
pub url: String,
}
+/// Default root-package name when `composer.json` omits the `name` field.
+/// Mirrors Composer's `RootPackageLoader` fallback.
+fn default_root_package_name() -> String {
+ "__root__".to_string()
+}
+
impl RawPackageData {
pub fn new(name: String) -> Self {
Self {
diff --git a/crates/mozart/tests/installer.rs b/crates/mozart/tests/installer.rs
index 5503476..a0e3f25 100644
--- a/crates/mozart/tests/installer.rs
+++ b/crates/mozart/tests/installer.rs
@@ -765,10 +765,7 @@ installer_fixture!(
update_syncs_outdated,
ignore = "mozart binary cannot yet run this fixture"
);
-installer_fixture!(
- update_to_empty_from_blank,
- ignore = "mozart binary cannot yet run this fixture"
-);
+installer_fixture!(update_to_empty_from_blank);
installer_fixture!(
update_to_empty_from_locked,
ignore = "mozart binary cannot yet run this fixture"