[January 26] #2394
Byron
announced in
Progress Update
[January 26]
#2394
Replies: 2 comments
-
|
cool projects. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Great work! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
A happy new year to everyone! And for
gitoxide, it feels like it starts with a bang!A new dawn for error handling:
exnviagix-errorIt all started with this blog post which inspired the massive changes that are in progress now.
The underlying problem is that
thiserroris#[non_exhaustive].thiserrorerrors is called, as each call needs a variant in a custom error struct.Getting away from that was a goal for a long time, but I was lacking the means.
anyhowis something that could work, but it's also quite large and a bit too much of the other end of the spectrum where errors are very unstructured and not meant for introspection, a feature that is needed here. Also, it doesn't implementstd::error::Errorwhich makes it completely unsuitable for library crates.exnwas a breath of fresh air as it's somewhere in the middle, while being very explicit about everything. And, as a huge bonus, it records the creation location of each error with#[track_caller].gix-errorcompletely forksexnto add what's needed to work ingitoxide, but work is underway to eventually reintegrated theexncrate.Here is the new system:
gix-errorprovides simple standard error types for common situations, likeMessageandParseError. These implementstd::error::Errorand can be used likeResult<T, Message>.std::error::ErrororExn<Error>, these routines will return something likeResult<T, Exn<Message>>to capture the error chain (or error tree).Exndoes not implementstd::error::Errorthough, as a limitation of the Rust typesystem, and is similar toanyhowin that regard.gix_error::Erroris returned bygixand it's essentially erasing types fromExnor any other errors, while providing facilities to introspect the call chain. This makes it similar togit2::Errorfor instance, which has proven to be so convenient I wouldn't want it any other way anymore. It also serves as a way to turn error trees powered byExnback into call chains that work well withanyhow.The conversion from
thiserroris time-consuming, and AI thus far couldn't do it, so I end up doing all of that by hand, while retaining the hope that one day AI can help with this arduous process.But what it does is to allow designing errors properly, making them easy to do in the implementations, that can also consciously think about what they want to expose for introspection later. And it turns out that we don't need everything, like what
thiserrormakes possible. Also, ingixone can choose to just use?everywhere, without the need for hundreds of error types just to allow making calls.Overall, I can't wait for fully removing
thiserrorand solve this huge issue once and for all.Community
Incubating SHA256 support: testing
Christoph Rüßler keeps chipping away at this seemingly giant topic single-handedly and recently introduced a way to run the existing fixtures with optional SHA-256 support. This creates a whole new repository that is set to SHA-256 on which tests can run.
The concept here is similar to what Git does, even though for now we are not running the entire test-suite twice, but instead take it on a crate-by-crate basis. Let's see where that goes and how long it takes. It feels somewhat similar in effort like the error conversion.
Bugfix in
gix-packthat surfaced withzlib-rsThis is a great fix of code that feels like it's as old as
gitoxideitself, and related to this issue: sometimes pack entries couldn't be decoded even though Git was fine with them, an issue that started to occur withzlib-rsbecoming the default.It turned out that
gix-packwas relying on ZIP never writing more to the output than what it needed to consume the input stream, something that is an implementation defined behavior.gitoxidealso never cared about how many output bytes were written, and due to its 'one buffer for everything' architecturezlib-rswas able to write over the undesignated output boundary into space where delta buffers were lined up for decoding… or something like it.This is the commit that fixes it, limiting the buffer that
zlib-rscan write to.A small fix, with large consequences, and a clear mistake on my end.
Gix in Cargo
There is nothing new here, but let's keep the horizon active:
Cheers
Sebastian
PS: The latest timesheets can be found here (2026).
Beta Was this translation helpful? Give feedback.
All reactions