For example, in mercury::internal::blob:
pub struct Blob {
pub id: SHA1,
pub data: Vec<u8>,
}
impl PartialEq for Blob {
/// The Blob object is equal to another Blob object if their IDs are equal.
fn eq(&self, other: &Self) -> bool {
self.data == other.data
}
}
Technically it is correct but inefficient, and it disagrees with the doc.
mercory::internal::commit:
pub struct Commit {
pub id: SHA1,
pub tree_id: SHA1,
pub parent_commit_ids: Vec<SHA1>,
pub author: Signature,
pub committer: Signature,
pub message: String,
}
impl PartialEq for Commit {
fn eq(&self, other: &Self) -> bool {
self.tree_id == other.tree_id
}
}
This is incorrect. git commit --allow-empty could create a new commit with the same tree id, while their commit id(hash) differ.
For example, in
mercury::internal::blob:Technically it is correct but inefficient, and it disagrees with the doc.
mercory::internal::commit:This is incorrect.
git commit --allow-emptycould create a new commit with the same tree id, while their commit id(hash) differ.