Skip to content

Commit f99c3b2

Browse files
committed
move commitgraph to 'free' (#331)
1 parent 83585bd commit f99c3b2

File tree

2 files changed

+42
-43
lines changed

2 files changed

+42
-43
lines changed

Diff for: src/plumbing/main.rs

+22-22
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use gitoxide_core::pack::verify;
1616
#[cfg(any(feature = "gitoxide-core-async-client", feature = "gitoxide-core-blocking-client"))]
1717
use crate::plumbing::options::remote;
1818
use crate::{
19-
plumbing::options::{commitgraph, free, repo, Args, Subcommands},
19+
plumbing::options::{free, repo, Args, Subcommands},
2020
shared::pretty::prepare_and_run,
2121
};
2222

@@ -78,6 +78,27 @@ pub fn main() -> Result<()> {
7878

7979
match cmd {
8080
Subcommands::Free(subcommands) => match subcommands {
81+
free::Subcommands::CommitGraph(subcommands) => match subcommands {
82+
free::commitgraph::Subcommands::Verify { path, statistics } => prepare_and_run(
83+
"commitgraph-verify",
84+
verbose,
85+
progress,
86+
progress_keep_open,
87+
None,
88+
move |_progress, out, err| {
89+
let output_statistics = if statistics { Some(format) } else { None };
90+
core::commitgraph::verify::graph_or_file(
91+
path,
92+
core::commitgraph::verify::Context {
93+
err,
94+
out,
95+
output_statistics,
96+
},
97+
)
98+
},
99+
)
100+
.map(|_| ()),
101+
},
81102
free::Subcommands::Index(free::index::Platform {
82103
object_hash,
83104
index_path,
@@ -635,27 +656,6 @@ pub fn main() -> Result<()> {
635656
},
636657
),
637658
},
638-
Subcommands::CommitGraph(subcommands) => match subcommands {
639-
commitgraph::Subcommands::Verify { path, statistics } => prepare_and_run(
640-
"commitgraph-verify",
641-
verbose,
642-
progress,
643-
progress_keep_open,
644-
None,
645-
move |_progress, out, err| {
646-
let output_statistics = if statistics { Some(format) } else { None };
647-
core::commitgraph::verify::graph_or_file(
648-
path,
649-
core::commitgraph::verify::Context {
650-
err,
651-
out,
652-
output_statistics,
653-
},
654-
)
655-
},
656-
)
657-
.map(|_| ()),
658-
},
659659
}?;
660660
Ok(())
661661
}

Diff for: src/plumbing/options.rs

+20-21
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ pub enum Subcommands {
5555
#[clap(subcommand)]
5656
#[cfg(any(feature = "gitoxide-core-async-client", feature = "gitoxide-core-blocking-client"))]
5757
Remote(remote::Subcommands),
58-
/// Subcommands for interacting with commit-graphs
59-
#[clap(subcommand)]
60-
CommitGraph(commitgraph::Subcommands),
6158
/// Subcommands for interacting with entire git repositories
6259
Repository(repo::Platform),
6360
/// Subcommands that need no git repository to run.
@@ -69,6 +66,9 @@ pub enum Subcommands {
6966
pub mod free {
7067
#[derive(Debug, clap::Subcommand)]
7168
pub enum Subcommands {
69+
/// Subcommands for interacting with commit-graphs
70+
#[clap(subcommand)]
71+
CommitGraph(commitgraph::Subcommands),
7272
/// Subcommands for interacting with mailmaps
7373
Mailmap {
7474
#[clap(flatten)]
@@ -81,6 +81,23 @@ pub mod free {
8181
Index(index::Platform),
8282
}
8383

84+
///
85+
pub mod commitgraph {
86+
use std::path::PathBuf;
87+
88+
#[derive(Debug, clap::Subcommand)]
89+
pub enum Subcommands {
90+
/// Verify the integrity of a commit graph
91+
Verify {
92+
/// The path to '.git/objects/info/', '.git/objects/info/commit-graphs/', or '.git/objects/info/commit-graph' to validate.
93+
path: PathBuf,
94+
/// output statistical information about the pack
95+
#[clap(long, short = 's')]
96+
statistics: bool,
97+
},
98+
}
99+
}
100+
84101
pub mod index {
85102
use std::path::PathBuf;
86103

@@ -585,24 +602,6 @@ pub mod repo {
585602
}
586603
}
587604

588-
///
589-
///
590-
pub mod commitgraph {
591-
use std::path::PathBuf;
592-
593-
#[derive(Debug, clap::Subcommand)]
594-
pub enum Subcommands {
595-
/// Verify the integrity of a commit graph
596-
Verify {
597-
/// The path to '.git/objects/info/', '.git/objects/info/commit-graphs/', or '.git/objects/info/commit-graph' to validate.
598-
path: PathBuf,
599-
/// output statistical information about the pack
600-
#[clap(long, short = 's')]
601-
statistics: bool,
602-
},
603-
}
604-
}
605-
606605
///
607606
#[cfg(any(feature = "gitoxide-core-async-client", feature = "gitoxide-core-blocking-client"))]
608607
pub mod remote {

0 commit comments

Comments
 (0)