use bstr::BString;
use git_transport::client::Capabilities;
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
pub enum Ref {
Peeled {
full_ref_name: BString,
tag: git_hash::ObjectId,
object: git_hash::ObjectId,
},
Direct {
full_ref_name: BString,
object: git_hash::ObjectId,
},
Symbolic {
full_ref_name: BString,
target: BString,
object: git_hash::ObjectId,
},
Unborn {
full_ref_name: BString,
target: BString,
},
}
#[derive(Default, Debug, Clone)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
pub struct Outcome {
pub server_protocol_version: git_transport::Protocol,
pub refs: Option<Vec<Ref>>,
pub capabilities: Capabilities,
}
mod error {
use bstr::BString;
use git_transport::client;
use crate::{credentials, handshake::refs};
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
pub enum Error {
#[error("Failed to obtain credentials")]
Credentials(#[from] credentials::protocol::Error),
#[error("Credentials provided for \"{url}\" were not accepted by the remote")]
InvalidCredentials { url: BString, source: std::io::Error },
#[error(transparent)]
Transport(#[from] client::Error),
#[error("The transport didn't accept the advertised server version {actual_version:?} and closed the connection client side")]
TransportProtocolPolicyViolation { actual_version: git_transport::Protocol },
#[error(transparent)]
ParseRefs(#[from] refs::parse::Error),
}
impl git_transport::IsSpuriousError for Error {
fn is_spurious(&self) -> bool {
match self {
Error::Transport(err) => err.is_spurious(),
_ => false,
}
}
}
}
pub use error::Error;
pub(crate) mod function;
pub mod refs;