Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
Add a `CommitObject::TryFrom<git2::Buf>` instance
Alexis Sellier committed 3 years ago
commit efdc8c52c77fa6d3afbc602b9334a8f11cedf77f
parent fece740fcbf4871bad2c233e8d95a6e4a3b007cb
1 file changed +8 -0
modified radicle/src/git.rs
@@ -323,6 +323,14 @@ pub mod commit {
        InvalidFormat,
    }

+
    impl TryFrom<git2::Buf> for CommitObject {
+
        type Error = ParseError;
+

+
        fn try_from(value: git2::Buf) -> Result<Self, Self::Error> {
+
            value.as_str().ok_or(ParseError::InvalidFormat)?.parse()
+
        }
+
    }
+

    impl FromStr for CommitObject {
        type Err = ParseError;