-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
Signed-off-by: Alexis Sellier <[email protected]>
Signed-off-by: Alexis Sellier <[email protected]>
eedeccf
to
b66d80f
Compare
pub use ext::Error; | ||
pub use ext::NotFound; |
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.
Re: radicle-dev/radicle-git#29
Ah, I see this actually the blob
re-exported. I don't think that should have been re-exported.
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.
Hmm, how to handle that then?
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.
What are you using it for?
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.
Actually I think I just use it here: https://github.com/radicle-dev/heartwood/pull/35/files#diff-ba1fcb4b7bb277619ac1f7a10d20d5b2ce6e199046a472cf8fe8f820b046708bR448
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.
I'd recommend you don't use it unless you're using that blob
API in particular :)
Sorry for the confusion!
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.
Ok, the thing is it would be nice to have a "good" git error type, which git_ext::Error
is pretty close to, or have maybe a RepositoryExt
trait that is more flexible. The ref.target()
case is a good example of this: most of the time you want the oid of a reference, and this involves repo.find_reference(...)?.target().ok_or(...)?
which is cumbersome.
So I use my own methods for getting references, which returns a git_ext::Error
, but this requires access to NotFound
, so that I can return a "not found" error when the target is missing. Without this, I'd have to create yet another git error type..
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.
I've created #38 to track this.
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.
In this case, you can use https://docs.rs/git2/0.15.0/git2/struct.Repository.html#method.refname_to_id, FYI :)
I'll continue the error discussion in the other issue.
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.
Omg I didn't know about this! Life changing!
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.
lol, I could swear I saw you use it before 😅
1ef994c
to
36d61e1
Compare
Signed-off-by: Alexis Sellier <[email protected]>
Signed-off-by: Alexis Sellier <[email protected]>
Signed-off-by: Alexis Sellier <[email protected]>
Signed-off-by: Alexis Sellier <[email protected]>
36d61e1
to
a104f96
Compare
Get rid of 99% of unwraps. Make unwraps warn by default, outside of test code.
See commits.
Closes #18