diff --git a/src/plumbing/main.rs b/src/plumbing/main.rs index 1d8e1686ba8..117ded16336 100644 --- a/src/plumbing/main.rs +++ b/src/plumbing/main.rs @@ -16,7 +16,7 @@ use gitoxide_core::pack::verify; #[cfg(any(feature = "gitoxide-core-async-client", feature = "gitoxide-core-blocking-client"))] use crate::plumbing::options::remote; use crate::{ - plumbing::options::{commitgraph, free, repo, Args, Subcommands}, + plumbing::options::{free, repo, Args, Subcommands}, shared::pretty::prepare_and_run, }; @@ -78,6 +78,27 @@ pub fn main() -> Result<()> { match cmd { Subcommands::Free(subcommands) => match subcommands { + free::Subcommands::CommitGraph(subcommands) => match subcommands { + free::commitgraph::Subcommands::Verify { path, statistics } => prepare_and_run( + "commitgraph-verify", + verbose, + progress, + progress_keep_open, + None, + move |_progress, out, err| { + let output_statistics = if statistics { Some(format) } else { None }; + core::commitgraph::verify::graph_or_file( + path, + core::commitgraph::verify::Context { + err, + out, + output_statistics, + }, + ) + }, + ) + .map(|_| ()), + }, free::Subcommands::Index(free::index::Platform { object_hash, index_path, @@ -635,27 +656,6 @@ pub fn main() -> Result<()> { }, ), }, - Subcommands::CommitGraph(subcommands) => match subcommands { - commitgraph::Subcommands::Verify { path, statistics } => prepare_and_run( - "commitgraph-verify", - verbose, - progress, - progress_keep_open, - None, - move |_progress, out, err| { - let output_statistics = if statistics { Some(format) } else { None }; - core::commitgraph::verify::graph_or_file( - path, - core::commitgraph::verify::Context { - err, - out, - output_statistics, - }, - ) - }, - ) - .map(|_| ()), - }, }?; Ok(()) } diff --git a/src/plumbing/options.rs b/src/plumbing/options.rs index 9b08ca5d0b0..8ce1bc55fed 100644 --- a/src/plumbing/options.rs +++ b/src/plumbing/options.rs @@ -55,9 +55,6 @@ pub enum Subcommands { #[clap(subcommand)] #[cfg(any(feature = "gitoxide-core-async-client", feature = "gitoxide-core-blocking-client"))] Remote(remote::Subcommands), - /// Subcommands for interacting with commit-graphs - #[clap(subcommand)] - CommitGraph(commitgraph::Subcommands), /// Subcommands for interacting with entire git repositories Repository(repo::Platform), /// Subcommands that need no git repository to run. @@ -69,6 +66,9 @@ pub enum Subcommands { pub mod free { #[derive(Debug, clap::Subcommand)] pub enum Subcommands { + /// Subcommands for interacting with commit-graphs + #[clap(subcommand)] + CommitGraph(commitgraph::Subcommands), /// Subcommands for interacting with mailmaps Mailmap { #[clap(flatten)] @@ -81,6 +81,23 @@ pub mod free { Index(index::Platform), } + /// + pub mod commitgraph { + use std::path::PathBuf; + + #[derive(Debug, clap::Subcommand)] + pub enum Subcommands { + /// Verify the integrity of a commit graph + Verify { + /// The path to '.git/objects/info/', '.git/objects/info/commit-graphs/', or '.git/objects/info/commit-graph' to validate. + path: PathBuf, + /// output statistical information about the pack + #[clap(long, short = 's')] + statistics: bool, + }, + } + } + pub mod index { use std::path::PathBuf; @@ -585,24 +602,6 @@ pub mod repo { } } -/// -/// -pub mod commitgraph { - use std::path::PathBuf; - - #[derive(Debug, clap::Subcommand)] - pub enum Subcommands { - /// Verify the integrity of a commit graph - Verify { - /// The path to '.git/objects/info/', '.git/objects/info/commit-graphs/', or '.git/objects/info/commit-graph' to validate. - path: PathBuf, - /// output statistical information about the pack - #[clap(long, short = 's')] - statistics: bool, - }, - } -} - /// #[cfg(any(feature = "gitoxide-core-async-client", feature = "gitoxide-core-blocking-client"))] pub mod remote {