Skip to content

Commit e6e90ff

Browse files
committed
Adapt to changes in gix-chunk
1 parent 0c68131 commit e6e90ff

6 files changed

Lines changed: 17 additions & 9 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gix-chunk/src/file/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl Index {
6666
.ok_or_else(|| message!("The offsets into the file couldn't be represented by usize"))?])
6767
}
6868

69-
/// Return the end offset lf the last chunk, which is the highest offset as well.
69+
/// Return the end offset of the last chunk, which is the highest offset as well.
7070
/// It's definitely available as we have one or more chunks.
7171
pub fn highest_offset(&self) -> crate::file::Offset {
7272
self.chunks.last().expect("at least one chunk").offset.end

gix-commitgraph/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ serde = ["dep:serde", "gix-hash/serde", "bstr/serde"]
2222
[dependencies]
2323
gix-hash = { version = "^0.21.0", path = "../gix-hash" }
2424
gix-chunk = { version = "^0.4.12", path = "../gix-chunk" }
25+
gix-error = { version = "^0.0.0", path = "../gix-error" }
2526

2627
bstr = { version = "1.12.0", default-features = false, features = ["std"] }
2728
memmap2 = "0.9.7"

gix-commitgraph/src/file/init.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::path::{Path, PathBuf};
22

33
use bstr::ByteSlice;
4+
use gix_error::message;
45

56
use crate::{
67
file::{
@@ -41,9 +42,9 @@ pub enum Error {
4142
#[error("Unsupported commit-graph file version: {0}")]
4243
UnsupportedVersion(u8),
4344
#[error(transparent)]
44-
ChunkFileDecode(#[from] gix_chunk::file::decode::Error),
45+
ChunkFileQuery(#[from] gix_error::Message),
4546
#[error(transparent)]
46-
MissingChunk(#[from] gix_chunk::file::index::offset_by_kind::Error),
47+
ChunkFileDecode(#[from] gix_error::ParseError),
4748
#[error("Commit-graph chunk {:?} has invalid size: {msg}", .id.as_bstr())]
4849
InvalidChunkSize { id: ChunkId, msg: String },
4950
}
@@ -194,9 +195,10 @@ impl File {
194195
}
195196

196197
if base_graph_count > 0 && base_graphs_list_offset.is_none() {
197-
return Err(gix_chunk::file::index::offset_by_kind::Error {
198-
kind: BASE_GRAPHS_LIST_CHUNK_ID,
199-
}
198+
return Err(message!(
199+
"Chunk named {:?} was not found in chunk file index",
200+
BASE_GRAPHS_LIST_CHUNK_ID.as_bstr()
201+
)
200202
.into());
201203
}
202204

gix-error/src/lib.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@
1212
//! # Standard Error Types
1313
//!
1414
//! These should always be used if they match the meaning of the error well enough instead of creating an own
15-
//! [`Error`](std::error::Error)-implementing type, and used with `Result|Option::or_raise(<StandardErrorType>)`.
15+
//! [`Error`](std::error::Error)-implementing type, and used with
16+
//! [`ResultExt::or_raise(<StandardErrorType>)`](ResultExt::or_raise) or
17+
//! [`OptionExt::ok_or_raise(<StandardErrorType>)`](OptionExt::ok_or_raise), or sibling methods.
1618
//!
1719
//! All these types implement [`Error`](std::error::Error).
1820
//!
1921
//! ## [`Message`]
2022
//!
2123
//! The baseline that provides a formatted message.
2224
//! Formatting can more easily be done with the [`message!`] macro as convenience, roughly equivalent to
23-
//! `Message(format!("…"))` or `format!("…").into()`.
25+
//! [`Message::new(format!("…"))`](Message::new) or `format!("…").into()`.
2426
//!
2527
//! ## Specialised types
2628
//!
@@ -30,7 +32,7 @@
3032
//! # [`Exn<ErrorType>`](Exn) and [`Exn`]
3133
//!
3234
//! The [`Exn`] type does not implement [`Error`](std::error::Error) itself, but is able to store causing errors
33-
//! via [`ResultExt::or_raise()`] (and friends) as well as location information of the creation site.
35+
//! via [`ResultExt::or_raise()`] (and sibling methods) as well as location information of the creation site.
3436
//!
3537
//! While plumbing functions that need to track causes should always return a distinct type like [`Exn<Message>`](Exn),
3638
//! if that's not possible, use [`Exn::erased`] to let it return `Result<T, Exn>` instead, allowing any return type.

gix-pack/src/multi_index/init.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ mod error {
2121
#[error("Unsupported hash kind: {kind})")]
2222
UnsupportedObjectHash { kind: u8 },
2323
#[error(transparent)]
24+
ChunkFileQuery(#[from] gix_error::Message),
25+
#[error(transparent)]
2426
ChunkFileDecode(#[from] gix_error::ParseError),
2527
#[error("The multi-pack fan doesn't have the correct size of 256 * 4 bytes")]
2628
MultiPackFanSize,

0 commit comments

Comments
 (0)