pub use self::source::GitSource;
pub use self::utils::{GitCheckout, GitDatabase, GitRemote, fetch, resolve_ref};
mod known_hosts;
mod oxide;
mod source;
mod utils;
pub mod fetch {
use crate::GlobalContext;
use crate::workspace::features::GitFeatures;
#[derive(Debug, Copy, Clone)]
pub enum RemoteKind {
GitDependency,
Registry,
}
impl RemoteKind {
pub(crate) fn to_shallow_setting(
&self,
repo_is_shallow: bool,
gctx: &GlobalContext,
) -> gix::remote::fetch::Shallow {
let has_feature = |cb: &dyn Fn(GitFeatures) -> bool| {
gctx.cli_unstable()
.git
.map_or(false, |features| cb(features))
};
if !repo_is_shallow {
match self {
RemoteKind::GitDependency if has_feature(&|features| features.shallow_deps) => {
}
RemoteKind::Registry if has_feature(&|features| features.shallow_index) => {}
_ => return gix::remote::fetch::Shallow::NoChange,
}
};
gix::remote::fetch::Shallow::DepthAtRemote(1.try_into().expect("non-zero"))
}
}
pub type Error = gix::env::collate::fetch::Error<gix::refspec::parse::Error>;
}