radicle: use git::raw::Error for reference_oid
The minimal error for the `ReadRepository::reference_oid` method is `git::raw::Error`. Change the error type from `git::ext::Error` to `git::raw::Error`. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
parent
92f21d7f29
commit
61b06553b4
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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>;
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue