Showing the changes to gitoxide-core/src/commitgraph (1 of 11 files). Show all
Unified · Split
| @@ -22,10 +22,10 @@ impl Default for Context<Vec<u8>, Vec<u8>> { · 21 unmodified lines | |||
| 22 | pub(crate) mod function { | 22 | pub(crate) mod function { |
| 23 | use std::{io, path::Path}; | 23 | use std::{io, path::Path}; |
| 24 | 24 | ||
| 25 | use anyhow::{Context as AnyhowContext, Result}; | ||
| 26 | use gix::commitgraph::{verify::Outcome, Graph}; | ||
| 27 | |||
| 28 | use crate::OutputFormat; | 25 | use crate::OutputFormat; |
| 26 | use anyhow::Result; | ||
| 27 | use gix::commitgraph::{verify::Outcome, Graph}; | ||
| 28 | use gix::Exn; | ||
| 29 | 29 | ||
| 30 | pub fn verify<W1, W2>( | 30 | pub fn verify<W1, W2>( |
| 31 | path: impl AsRef<Path>, | 31 | path: impl AsRef<Path>, |
| @@ -34,20 +34,18 @@ pub(crate) mod function { · 2 unmodified lines | |||
| 34 | mut out, | 34 | mut out, |
| 35 | output_statistics, | 35 | output_statistics, |
| 36 | }: super::Context<W1, W2>, | 36 | }: super::Context<W1, W2>, |
| 37 | ) -> Result<gix::commitgraph::verify::Outcome> | 37 | ) -> Result<Outcome> |
| 38 | where | 38 | where |
| 39 | W1: io::Write, | 39 | W1: io::Write, |
| 40 | W2: io::Write, | 40 | W2: io::Write, |
| 41 | { | 41 | { |
| 42 | let g = Graph::at(path.as_ref()).with_context(|| "Could not open commit graph")?; | 42 | let g = Graph::at(path.as_ref()).map_err(Exn::into_error)?; |
| 43 | 43 | ||
| 44 | #[allow(clippy::unnecessary_wraps, unknown_lints)] | 44 | #[allow(clippy::unnecessary_wraps, unknown_lints)] |
| 45 | fn noop_processor(_commit: &gix::commitgraph::file::Commit<'_>) -> std::result::Result<(), std::fmt::Error> { | 45 | fn noop_processor(_commit: &gix::commitgraph::file::Commit<'_>) -> std::result::Result<(), std::fmt::Error> { |
| 46 | Ok(()) | 46 | Ok(()) |
| 47 | } | 47 | } |
| 48 | let stats = g | 48 | let stats = g.verify_integrity(noop_processor).map_err(Exn::into_error)?; |
| 49 | .verify_integrity(noop_processor) | ||
| 50 | .with_context(|| "Verification failure")?; | ||
| 51 | 49 | ||
| 52 | #[cfg_attr(not(feature = "serde"), allow(clippy::single_match))] | 50 | #[cfg_attr(not(feature = "serde"), allow(clippy::single_match))] |
| 53 | match output_statistics { | 51 | match output_statistics { |