fix: update .info base_id if it is mismatched or empty (#14430)

* fix: update .info base_id if it is mismatched or empty

* Merge branch 'main' into fix/update-base-id-on-mismatch-or-missing

* early return
This commit is contained in:
Ian Chua
2026-06-27 23:07:44 +08:00
committed by SoftFever
parent 2a1fdcc0b9
commit 3808f95a26

View File

@@ -3042,6 +3042,25 @@ void PresetCollection::check_and_fix_syncinfo(Preset& preset, const std::string&
preset.updated_time = 0;
preset.sync_info = "create";
preset.save_info();
return;
}
const auto inherits = Preset::inherits(preset.config);
Preset* parent = find_preset2(inherits, true);
if (!inherits.empty() && parent) {
const std::string expected = parent->setting_id;
if (expected.empty()) {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": Direct parent of " << preset.name << " does not have a setting_id";
return;
}
// Reconcile a missing or stale base_id against the direct parent's setting_id.
if (preset.base_id != expected) {
preset.base_id = expected;
// Already-synced preset whose base changed -> re-push it.
if (!preset.setting_id.empty() && preset.sync_info.empty())
preset.sync_info = "update";
preset.save_info();
}
}
}