-
-
Notifications
You must be signed in to change notification settings - Fork 415
Convert gix-revision to use gix-error and update gix API #2361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR converts gix-revision from using thiserror to gix-error, following the pattern established in gix-date. The conversion simplifies error handling by replacing structured error enums with string-based error messages.
Changes:
- Replaced
spec::parse::Errorenum (15+ variants) withgix_error::ParseErrortype alias - Converted
describe::Errorandmerge_base::Errorto simple wrapper types with string messages - Updated all 50+ error construction sites to use
Error::new()andError::new_with_input() - Modified 112 test assertions to check error messages/input using substring matching instead of enum variant matching
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| gix-revision/Cargo.toml | Removed thiserror dependency |
| Cargo.lock | Updated to reflect removal of thiserror from gix-revision |
| gix-revision/src/spec/parse/mod.rs | Replaced Error enum with gix_error::ParseError type alias |
| gix-revision/src/spec/parse/function.rs | Updated all error construction sites to use Error::new() and Error::new_with_input() |
| gix-revision/src/merge_base/mod.rs | Introduced Simple(&'static str) error wrapper for static error messages |
| gix-revision/src/merge_base/function.rs | Updated error construction to use Simple wrapper with static strings |
| gix-revision/src/describe.rs | Introduced Simple(String) error wrapper for dynamic error messages (e.g., with commit hashes) |
| gix-revision/tests/revision/spec/parse/navigate/tilde_symbol.rs | Updated test assertions to check error message content |
| gix-revision/tests/revision/spec/parse/navigate/caret_symbol.rs | Updated test assertions to check error message content and input |
| gix-revision/tests/revision/spec/parse/kind.rs | Updated test assertions to check error message content |
| gix-revision/tests/revision/spec/parse/anchor/refnames.rs | Updated test assertions to check error message content and input |
| gix-revision/tests/revision/spec/parse/anchor/colon_symbol.rs | Updated test assertions to check error message content and input |
| gix-revision/tests/revision/spec/parse/anchor/at_symbol.rs | Updated test assertions to check error message content and input |
Co-authored-by: Byron <[email protected]>
b55cf08 to
6d13b1c
Compare
|
@copilot let |
I've updated Commit: daed5d3 |
daed5d3 to
5438e06
Compare
- Add a `Message` error to `gix-error` for general use.
5438e06 to
2eb7f60
Compare
Removes
thiserrorfromgix-revisionand converts togix-error, following the pattern established ingix-date. Additionally updates thegixcrate's API to returngix::Errorfrom revision parsing functions.Changes
gix_error::ParseErrorinstead of custom enum with 15+ variantsError::new()andError::new_with_input()Spec::from_bstr()now returnsgix::Errorinstead ofrevision::spec::parse::ErrorRepository::rev_parse()now returnsgix::Errorgix_error::Message::new(format!(...))for inline error messagesBefore/After
All tests passing.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.