mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-11-21 18:40:40 +08:00
radicle-git-ext: remove multihash and minicbor
Multihash was deemed as not needed for compatibility since it is possible to detect a change from SHA1 to SHA256 based on their encoded lengths. The YAGNI principle is executed and multihash (and minicbor while we're here) are removed. This also had an effect on `Urn` which relied heavily on encoding the value using multihash. The `urn` and `namespace` modules were removed from radicle-git-types, since they were likely not going to be used anyway. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
@@ -635,77 +635,3 @@ impl From<&git_ref_format::refspec::PatternStr> for RefspecPattern {
|
||||
Self(r.to_owned().into())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "minicbor")]
|
||||
mod minicbor_impls {
|
||||
use super::*;
|
||||
use minicbor::{
|
||||
decode,
|
||||
encode::{self, Write},
|
||||
Decode,
|
||||
Decoder,
|
||||
Encode,
|
||||
Encoder,
|
||||
};
|
||||
|
||||
impl Encode for RefLike {
|
||||
fn encode<W: Write>(&self, e: &mut Encoder<W>) -> Result<(), encode::Error<W::Error>> {
|
||||
e.str(self.as_str())?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'b> Decode<'b> for RefLike {
|
||||
fn decode(d: &mut Decoder) -> Result<Self, decode::Error> {
|
||||
let path = d.str()?;
|
||||
Self::try_from(path).or(Err(decode::Error::Message("invalid reflike")))
|
||||
}
|
||||
}
|
||||
|
||||
impl minicbor::Encode for OneLevel {
|
||||
fn encode<W: Write>(&self, e: &mut Encoder<W>) -> Result<(), encode::Error<W::Error>> {
|
||||
e.str(self.as_str())?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'b> Decode<'b> for OneLevel {
|
||||
fn decode(d: &mut Decoder) -> Result<Self, decode::Error> {
|
||||
let refl: RefLike = Decode::decode(d)?;
|
||||
Ok(Self::from(refl))
|
||||
}
|
||||
}
|
||||
|
||||
impl Encode for Qualified {
|
||||
fn encode<W: encode::Write>(
|
||||
&self,
|
||||
e: &mut Encoder<W>,
|
||||
) -> Result<(), encode::Error<W::Error>> {
|
||||
e.str(self.as_str())?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'b> Decode<'b> for Qualified {
|
||||
fn decode(d: &mut Decoder) -> Result<Self, decode::Error> {
|
||||
let refl: RefLike = Decode::decode(d)?;
|
||||
Ok(Self::from(refl))
|
||||
}
|
||||
}
|
||||
|
||||
impl Encode for RefspecPattern {
|
||||
fn encode<W: encode::Write>(
|
||||
&self,
|
||||
e: &mut Encoder<W>,
|
||||
) -> Result<(), encode::Error<W::Error>> {
|
||||
e.str(self.as_str())?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'b> Decode<'b> for RefspecPattern {
|
||||
fn decode(d: &mut Decoder) -> Result<Self, decode::Error> {
|
||||
Self::try_from(d.str()?).or(Err(decode::Error::Message("invalid refspec pattern")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user