History

Impl == and != for common combinations of ObjectId/oid (#63)

Sebastian Thiel committed 5 years ago

Commit 24551781 parent 59ab1bd5 files · +20 −8Browse files

Showing the changes to git-commitgraph/src (1 of 5 files). Show all

Unified · Split

git-commitgraph/src/file/verify.rs+2−2
@@ -154,7 +154,7 @@ impl File { · 153 unmodified lines
154 let actual = git_hash::ObjectId::new_sha1(hasher.digest());154 let actual = git_hash::ObjectId::new_sha1(hasher.digest());
155 155
156 let expected = self.checksum();156 let expected = self.checksum();
157 if actual.as_ref() == expected {157 if actual == expected {
158 Ok(actual)158 Ok(actual)
159 } else {159 } else {
160 Err((actual, expected.into()))160 Err((actual, expected.into()))
@@ -171,7 +171,7 @@ fn verify_split_chain_filename_hash(path: impl AsRef<Path>, expected: &git_hash: · 10 unmodified lines
171 .and_then(|filename| filename.strip_suffix(".graph"))171 .and_then(|filename| filename.strip_suffix(".graph"))
172 .and_then(|stem| stem.strip_prefix("graph-"))172 .and_then(|stem| stem.strip_prefix("graph-"))
173 .map_or(Ok(()), |hex| match git_hash::ObjectId::from_hex(hex.as_bytes()) {173 .map_or(Ok(()), |hex| match git_hash::ObjectId::from_hex(hex.as_bytes()) {
174 Ok(actual) if actual.as_ref() == expected => Ok(()),174 Ok(actual) if actual == expected => Ok(()),
175 _ => Err(format!("graph-{}.graph", expected.to_sha1_hex().as_bstr())),175 _ => Err(format!("graph-{}.graph", expected.to_sha1_hex().as_bstr())),
176 })176 })
177}177}