Skip to content
Clone
075d82d
26 lines 606 B Rust
use std::path::PathBuf;
#[derive(Clone, Debug)]
pub enum GitOperation {
UploadPack { bare: PathBuf },
ReceivePack { bare: PathBuf },
}
impl GitOperation {
pub fn bare(&self) -> &PathBuf {
match self {
Self::UploadPack { bare } | Self::ReceivePack { bare } => bare,
}
}
pub fn is_write(&self) -> bool {
matches!(self, Self::ReceivePack { .. })
}
pub fn service_arg(&self) -> &'static str {
match self {
Self::UploadPack { .. } => "upload-pack",
Self::ReceivePack { .. } => "receive-pack",
}
}
}