diff --git a/git-odb/src/loose/db/write.rs b/git-odb/src/loose/db/write.rs index 1bc48abe24b..68db519b65c 100644 --- a/git-odb/src/loose/db/write.rs +++ b/git-odb/src/loose/db/write.rs @@ -14,6 +14,7 @@ quick_error! { source(err) } IoRaw(err: io::Error) { + display("An IO error occurred while writing an object") source(err) from() } diff --git a/git-odb/src/pack/index/traverse/mod.rs b/git-odb/src/pack/index/traverse/mod.rs index 339ac7ca670..77433e1235c 100644 --- a/git-odb/src/pack/index/traverse/mod.rs +++ b/git-odb/src/pack/index/traverse/mod.rs @@ -16,6 +16,7 @@ quick_error! { #[derive(Debug)] pub enum Error { Processor(err: Box) { + display("One of the traversal processors failed") source(&**err) from() } @@ -25,6 +26,7 @@ quick_error! { from() } Graph(err: pack::graph::Error) { + display("The pack delta graph could not be built") from() source(err) } diff --git a/gitoxide-core/src/pack/explode.rs b/gitoxide-core/src/pack/explode.rs index fcf921fc9eb..753e729cb55 100644 --- a/gitoxide-core/src/pack/explode.rs +++ b/gitoxide-core/src/pack/explode.rs @@ -63,10 +63,12 @@ quick_error! { #[derive(Debug)] enum Error { Io(err: std::io::Error) { + display("An IO error occurred while writing an object") source(err) from() } - Odb(err: loose::db::write::Error) { + OdbWrite(err: loose::db::write::Error) { + display("An object could not be written to the database") source(err) from() } @@ -155,7 +157,7 @@ where } }, pack::cache::DecodeEntryLRU::default, - ).map(|(_,_,c)|progress::DoOrDiscard::from(c)).with_context(|| "Some loose objects could not be extracted")?; + ).map(|(_,_,c)|progress::DoOrDiscard::from(c)).with_context(|| "Failed to explode the entire pack - some loose objects may have been created nonetheless")?; let (index_path, data_path) = (bundle.index.path().to_owned(), bundle.pack.path().to_owned()); drop(bundle); diff --git a/src/plumbing/pretty.rs b/src/plumbing/pretty.rs index d3025250a51..471bc04d273 100644 --- a/src/plumbing/pretty.rs +++ b/src/plumbing/pretty.rs @@ -34,7 +34,7 @@ mod options { #[structopt(long)] delete_pack: bool, - /// The amount of checks to run. Defaults to 'all'. + /// The amount of checks to run #[structopt( long, short = "c", diff --git a/tests/snapshots/plumbing-pack-explode-missing-objects-dir-fail b/tests/snapshots/plumbing-pack-explode-missing-objects-dir-fail new file mode 100644 index 00000000000..bad9f21a7af --- /dev/null +++ b/tests/snapshots/plumbing-pack-explode-missing-objects-dir-fail @@ -0,0 +1,8 @@ +Error: Failed to explode the entire pack - some loose objects may have been created nonetheless + +Caused by: + 0: One of the traversal processors failed + 1: Failed to write commit object 501b297447a8255d3533c6858bb692575cdefaa0 + 2: An object could not be written to the database + 3: Could not create named temp file in 'does-not-exist' + 4: No such file or directory (os error 2) at path "/Users/byron/dev/grit-rs/does-not-exist/.tmpAiSVb8" \ No newline at end of file diff --git a/tests/stateless-journey.sh b/tests/stateless-journey.sh index 342240f44a4..8a8b2cd2659 100755 --- a/tests/stateless-journey.sh +++ b/tests/stateless-journey.sh @@ -42,7 +42,7 @@ title "CLI ${kind}" (when "running 'plumbing pack-explode" PACK_FILE="$fixtures/packs/pack-11fdfa9e156ab73caae3b6da867192221f2089c2" - (with "no directory specified" + (with "no objects directory specified" it "explodes the pack successfully and with desired output" && { WITH_SNAPSHOT="$snapshot/plumbing-pack-explode-to-sink-success" \ expect_run $SUCCESSFULLY "$exe_plumbing" pack-explode "${PACK_FILE}.idx" @@ -62,14 +62,14 @@ title "CLI ${kind}" expect_run $WITH_FAILURE ls ${PACK_FILE}.idx } ) - (with "TODO(how to write into the middle of a file in bash): an invalid pack" - - ) ) ) ) (with "a non-existing directory specified" - + it "fails with a helpful error message" && { + WITH_SNAPSHOT="$snapshot/plumbing-pack-explode-missing-objects-dir-fail" \ + expect_run $WITH_FAILURE "$exe_plumbing" pack-explode "${PACK_FILE}.idx" does-not-exist + } ) (with "an existing directory specified"