use std::{
borrow::Cow,
path::{Path, PathBuf},
};
use crate::{bstr::BStr, store::WriteReflog, Namespace};
#[derive(Debug, Clone)]
pub struct Store {
git_dir: PathBuf,
common_dir: Option<PathBuf>,
object_hash: git_hash::Kind,
pub write_reflog: WriteReflog,
pub namespace: Option<Namespace>,
packed: packed::modifiable::MutableSharedBuffer,
}
mod access {
use std::path::Path;
use crate::file;
impl file::Store {
pub fn git_dir(&self) -> &Path {
&self.git_dir
}
pub fn common_dir(&self) -> Option<&Path> {
self.common_dir.as_deref()
}
pub fn common_dir_resolved(&self) -> &Path {
self.common_dir.as_deref().unwrap_or(&self.git_dir)
}
}
}
pub struct Transaction<'s, 'p> {
store: &'s Store,
packed_transaction: Option<crate::store_impl::packed::Transaction>,
updates: Option<Vec<transaction::Edit>>,
packed_refs: transaction::PackedRefs<'p>,
}
pub(in crate::store_impl::file) fn path_to_name<'a>(path: impl Into<Cow<'a, Path>>) -> Cow<'a, BStr> {
let path = git_path::into_bstr(path.into());
git_path::to_unix_separators_on_windows(path)
}
pub mod loose;
mod overlay_iter;
pub mod iter {
pub use super::overlay_iter::{LooseThenPacked, Platform};
pub mod loose_then_packed {
pub use super::super::overlay_iter::Error;
}
}
pub mod log;
pub mod find;
pub mod transaction;
pub mod packed;
mod raw_ext;
pub use raw_ext::ReferenceExt;