use crate::{FullName, Kind, Target};
#[derive(Debug, PartialOrd, PartialEq, Ord, Eq, Hash, Clone)]
pub struct Reference {
pub name: FullName,
pub target: Target,
}
impl Reference {
pub fn kind(&self) -> Kind {
self.target.kind()
}
}
pub(crate) mod reflog;
pub(crate) mod iter;
pub mod reference;
mod init {
use std::path::PathBuf;
use crate::store_impl::file;
impl file::Store {
pub fn at(
git_dir: PathBuf,
write_reflog: file::WriteReflog,
object_hash: gix_hash::Kind,
precompose_unicode: bool,
) -> Self {
file::Store {
git_dir,
packed_buffer_mmap_threshold: packed_refs_mmap_threshold(),
common_dir: None,
write_reflog,
namespace: None,
packed: gix_fs::SharedFileSnapshotMut::new().into(),
object_hash,
precompose_unicode,
}
}
pub fn for_linked_worktree(
git_dir: PathBuf,
common_dir: PathBuf,
write_reflog: file::WriteReflog,
object_hash: gix_hash::Kind,
precompose_unicode: bool,
) -> Self {
file::Store {
git_dir,
packed_buffer_mmap_threshold: packed_refs_mmap_threshold(),
common_dir: Some(common_dir),
write_reflog,
namespace: None,
packed: gix_fs::SharedFileSnapshotMut::new().into(),
object_hash,
precompose_unicode,
}
}
}
fn packed_refs_mmap_threshold() -> u64 {
if cfg!(windows) {
u64::MAX
} else {
32 * 1024
}
}
}