From b3b70e6d7c2ec6787d0b492442bb4f7537b4b580 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 28 Jun 2023 23:00:57 +0200 Subject: Add asset_hashes_can_differ option to the equality checks. Before recent changes Asset::_hash would be empty when the equality checks were run (and Asset::equals() compares them directly). This mean that differences in asset hash were being ignored, but are no longer; so now we need this option to restore that behaviour where required. --- src/asset.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/asset.cc') diff --git a/src/asset.cc b/src/asset.cc index d88c690d..330bd653 100644 --- a/src/asset.cc +++ b/src/asset.cc @@ -143,11 +143,15 @@ Asset::hash (function progress) const bool -Asset::equals (std::shared_ptr other, EqualityOptions, NoteHandler note) const +Asset::equals(std::shared_ptr other, EqualityOptions opt, NoteHandler note) const { if (_hash != other->_hash) { - note (NoteType::ERROR, "Asset: hashes differ"); - return false; + if (!opt.asset_hashes_can_differ) { + note(NoteType::ERROR, "Asset: hashes differ"); + return false; + } else { + note(NoteType::NOTE, "Asset: hashes differ"); + } } return true; -- cgit v1.2.3