Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle: use git::raw::Error for reference_oid
Fintan Halpenny committed 2 years ago
commit 61b06553b461b982fb59808d1dad9d6a1548732a
parent 92f21d7f299c71a8cd7848cbec92df34fb92fe56
6 files changed +9 -9
modified radicle/src/cob/store.rs
@@ -94,7 +94,7 @@ pub enum Error {
    RefLookup {
        name: git::RefString,
        #[source]
-
        err: git::Error,
+
        err: git::raw::Error,
    },
}

@@ -210,8 +210,7 @@ where
                self.repo.sign_refs(signer).map_err(Error::SignRefs)?;
                Ok(())
            }
-
            Err(git::Error::NotFound(_)) => Ok(()),
-
            Err(git::Error::Git(err)) if err.code() == git::raw::ErrorCode::NotFound => Ok(()),
+
            Err(err) if err.code() == git::raw::ErrorCode::NotFound => Ok(()),
            Err(err) => Err(Error::RefLookup {
                name: name.to_ref_string(),
                err,
modified radicle/src/storage.rs
@@ -441,7 +441,7 @@ pub trait ReadRepository: Sized + ValidateRepository {
        &self,
        remote: &RemoteId,
        reference: &Qualified,
-
    ) -> Result<Oid, git_ext::Error>;
+
    ) -> Result<Oid, git::raw::Error>;

    /// Get all references of the given remote.
    fn references_of(&self, remote: &RemoteId) -> Result<Refs, Error>;
modified radicle/src/storage/git.rs
@@ -517,7 +517,7 @@ impl ReadRepository for Repository {
        &self,
        remote: &RemoteId,
        reference: &git::Qualified,
-
    ) -> Result<Oid, git::Error> {
+
    ) -> Result<Oid, git::raw::Error> {
        let name = reference.with_namespace(remote.into());
        let oid = self.backend.refname_to_id(&name)?;

@@ -638,6 +638,7 @@ impl ReadRepository for Repository {

    fn identity_head_of(&self, remote: &RemoteId) -> Result<Oid, git::ext::Error> {
        self.reference_oid(remote, &git::refs::storage::IDENTITY_BRANCH)
+
            .map_err(git::ext::Error::from)
    }

    fn identity_root(&self) -> Result<Oid, RepositoryError> {
modified radicle/src/storage/git/cob.rs
@@ -306,7 +306,7 @@ impl<'a, R: storage::ReadRepository> ReadRepository for DraftStore<'a, R> {
        &self,
        remote: &RemoteId,
        reference: &git::Qualified,
-
    ) -> Result<git_ext::Oid, git_ext::Error> {
+
    ) -> Result<git_ext::Oid, git::raw::Error> {
        self.repo.reference_oid(remote, reference)
    }

modified radicle/src/storage/refs.rs
@@ -57,6 +57,7 @@ impl Error {
        match self {
            Self::GitExt(git::Error::NotFound(_)) => true,
            Self::GitExt(git::Error::Git(e)) if git::is_not_found_err(e) => true,
+
            Self::Git(e) if git::is_not_found_err(e) => true,
            _ => false,
        }
    }
@@ -385,8 +386,7 @@ impl SignedRefsAt {
    {
        let at = match repo.reference_oid(&remote, &SIGREFS_BRANCH) {
            Ok(at) => at,
-
            Err(git::ext::Error::NotFound(_)) => return Ok(None),
-
            Err(git::ext::Error::Git(e)) if git::is_not_found_err(&e) => return Ok(None),
+
            Err(e) if git::is_not_found_err(&e) => return Ok(None),
            Err(e) => return Err(e.into()),
        };
        Self::load_at(at, remote, repo).map(Some)
modified radicle/src/test/storage.rs
@@ -212,7 +212,7 @@ impl ReadRepository for MockRepository {
        &self,
        _remote: &RemoteId,
        _reference: &git::Qualified,
-
    ) -> Result<git_ext::Oid, git_ext::Error> {
+
    ) -> Result<git_ext::Oid, git::raw::Error> {
        Ok(Oid::from_str("ffffffffffffffffffffffffffffffffffffffff").unwrap())
    }