use crate::Repository;
use sley_core::ObjectFormat;
#[cfg(feature = "remote")]
use sley_remote::TransportCapabilities;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct RepositoryCapabilities {
pub notes: bool,
pub annotated_tags: bool,
pub config_includes: bool,
pub hasconfig_include_if: bool,
pub index: bool,
pub shallow: bool,
pub sha256: bool,
}
impl RepositoryCapabilities {
pub const fn current() -> Self {
Self {
notes: true,
annotated_tags: true,
config_includes: true,
hasconfig_include_if: true,
index: true,
shallow: true,
sha256: true,
}
}
}
impl Repository {
pub fn capabilities(&self) -> RepositoryCapabilities {
let mut caps = RepositoryCapabilities::current();
caps.shallow = self.is_shallow();
caps.sha256 = self.object_format() == ObjectFormat::Sha256;
caps
}
#[cfg(feature = "remote")]
pub fn transport_capabilities(&self) -> TransportCapabilities {
TransportCapabilities::current()
}
}