History

refactor; better errors for invalid hash sizes(#63)

Sebastian Thiel committed 5 years ago

Commit be84b361 parent 6f9706318 files · +47 −43Browse files

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

Unified · Split

git-commitgraph/src/file/verify.rs+3−5
@@ -175,10 +175,8 @@ fn verify_split_chain_filename_hash( · 174 unmodified lines
175175 .and_then(|filename| filename.to_str())
176176 .and_then(|filename| filename.strip_suffix(".graph"))
177177 .and_then(|stem| stem.strip_prefix("graph-"))
178− .map_or(Ok(()), |hex| {
179− match git_hash::ObjectId::from_40_bytes_in_hex(hex.as_bytes()) {
180− Ok(actual) if actual.to_borrowed() == expected => Ok(()),
181− _ => Err(format!("graph-{}.graph", expected.to_sha1_hex().as_bstr())),
182− }
178+ .map_or(Ok(()), |hex| match git_hash::ObjectId::from_hex(hex.as_bytes()) {
179+ Ok(actual) if actual.to_borrowed() == expected => Ok(()),
180+ _ => Err(format!("graph-{}.graph", expected.to_sha1_hex().as_bstr())),
183181 })
184182 }