diff --git a/src/plumbing/lean.rs b/src/plumbing/lean.rs index 14c1362ba17..2088962c0ff 100644 --- a/src/plumbing/lean.rs +++ b/src/plumbing/lean.rs @@ -53,9 +53,9 @@ mod options { /// Possible values are "less-time" and "less-memory". Default is "less-memory". pub algorithm: Option<core::VerifyAlgorithm>, - /// output statistical information about the pack - #[argh(switch, short = 's')] - pub statistics: bool, + /// do not automatically output statistical information about the pack + #[argh(switch)] + pub no_statistics: bool, /// verbose progress messages are printed line by line #[argh(switch, short = 'v')] pub verbose: bool, @@ -103,7 +103,7 @@ pub fn main() -> Result<()> { SubCommands::VerifyPack(VerifyPack { path, verbose, - statistics, + no_statistics, algorithm, decode, re_encode, @@ -113,10 +113,10 @@ pub fn main() -> Result<()> { path, progress, core::Context { - output_statistics: if statistics { - Some(core::OutputFormat::Human) - } else { + output_statistics: if no_statistics { None + } else { + Some(core::OutputFormat::Human) }, algorithm: algorithm.unwrap_or(core::VerifyAlgorithm::LessTime), thread_limit, diff --git a/src/plumbing/pretty.rs b/src/plumbing/pretty.rs index dcbfda42fd0..c3328832d22 100644 --- a/src/plumbing/pretty.rs +++ b/src/plumbing/pretty.rs @@ -29,9 +29,9 @@ mod options { /// Verify the integrity of a pack or index file #[structopt(setting = AppSettings::ColoredHelp)] VerifyPack { - /// output statistical information about the pack - #[structopt(long, short = "s")] - statistics: bool, + /// Do not output statistical information about the pack + #[structopt(long)] + no_statistics: bool, /// Determine the format to use when outputting statistics. #[structopt( long, @@ -189,7 +189,7 @@ pub fn main() -> Result<()> { decode, re_encode, progress_keep_open, - statistics, + no_statistics, } => prepare_and_run( "verify-pack", verbose, @@ -201,7 +201,7 @@ pub fn main() -> Result<()> { (true, true) | (false, true) => core::VerifyMode::Sha1CRC32DecodeEncode, (false, false) => core::VerifyMode::Sha1CRC32, }; - let output_statistics = if statistics { Some(format) } else { None }; + let output_statistics = if no_statistics { None } else { Some(format) }; core::verify_pack_or_pack_index( path, progress, diff --git a/tasks.md b/tasks.md index cd2a4f17932..3ca9c491b3a 100644 --- a/tasks.md +++ b/tasks.md @@ -23,7 +23,7 @@ * [x] choice of algorithm in pack-verify * [x] use pack streaming in pack-verify by default * [x] set some unit tests cases to use the streaming algorithm - * [ ] invert '--statistics' to become '--no-statistics' (it's free now) + * [x] invert '--statistics' to become '--no-statistics' (it's free now) * **progress - convenience** * [ ] `inc()` method * [ ] `inc_by(step)` method diff --git a/tests/stateless-journey.sh b/tests/stateless-journey.sh index 694babfb2bd..6f53c9218ed 100755 --- a/tests/stateless-journey.sh +++ b/tests/stateless-journey.sh @@ -53,32 +53,38 @@ title "CLI ${kind}" (with "no statistics" it "verifies the pack index successfully and with desired output" && { WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-success" \ - expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack "$PACK_INDEX_FILE" + expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --no-statistics "$PACK_INDEX_FILE" } ) (with "statistics" it "verifies the pack index successfully and with desired output" && { WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-with-statistics-success" \ - expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --statistics "$PACK_INDEX_FILE" + expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack "$PACK_INDEX_FILE" + } + ) + (with "statistics and less-memory algorithm" + it "verifies the pack index successfully and with desired output" && { + WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-with-statistics-success" \ + expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --algorithm less-memory "$PACK_INDEX_FILE" } ) (with "decode" it "verifies the pack index successfully and with desired output, and decodes all objects" && { WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-success" \ - expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --algorithm less-memory --decode "$PACK_INDEX_FILE" + expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --no-statistics --algorithm less-memory --decode "$PACK_INDEX_FILE" } ) (with "re-encode" it "verifies the pack index successfully and with desired output, and re-encodes all objects" && { WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-success" \ - expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --algorithm less-time --re-encode "$PACK_INDEX_FILE" + expect_run $SUCCESSFULLY "$exe_plumbing" verify-pack --algorithm less-time --no-statistics --re-encode "$PACK_INDEX_FILE" } ) if test "$kind" = "max"; then (with "statistics (JSON)" it "verifies the pack index successfully and with desired output" && { WITH_SNAPSHOT="$snapshot/plumbing-verify-pack-index-with-statistics-json-success" \ - expect_run $SUCCESSFULLY "$exe_plumbing" --threads 1 verify-pack --statistics --format json "$PACK_INDEX_FILE" + expect_run $SUCCESSFULLY "$exe_plumbing" --threads 1 verify-pack --format json "$PACK_INDEX_FILE" } ) fi