diff --git a/swh/model/model.py b/swh/model/model.py --- a/swh/model/model.py +++ b/swh/model/model.py @@ -743,7 +743,9 @@ id = attr.ib(type=Sha1Git, validator=type_validator(), default=b"", repr=hash_repr) def _compute_hash_from_attributes(self) -> bytes: - return _compute_hash_from_manifest(git_objects.snapshot_git_object(self)) + return _compute_hash_from_manifest( + git_objects.snapshot_git_object(self, ignore_unresolved=True) + ) @classmethod def from_dict(cls, d): diff --git a/swh/model/tests/test_identifiers.py b/swh/model/tests/test_identifiers.py --- a/swh/model/tests/test_identifiers.py +++ b/swh/model/tests/test_identifiers.py @@ -755,8 +755,9 @@ ) def test_unresolved(self): - with self.assertRaisesRegex(ValueError, "b'foo' -> b'bar'"): - Snapshot.from_dict(remove_id(self.unresolved)) + self.assertEqual( + Snapshot.from_dict(remove_id(self.unresolved)).id, self.unresolved["id"] + ) def test_git_object_unresolved(self): with self.assertRaisesRegex(ValueError, "b'foo' -> b'bar'"):