use gix_error::{ExnResult, Message, ResultExt};
use std::path::PathBuf;
use crate::file;
#[expect(
dead_code,
reason = "callers still initialize file::Store directly while the general store awaits ref-table support"
)]
impl crate::Store {
pub fn at(git_dir: PathBuf, object_hash: gix_hash::Kind) -> ExnResult<Self> {
Self::at_opts(git_dir, object_hash, Default::default())
}
pub fn at_opts(
git_dir: PathBuf,
object_hash: gix_hash::Kind,
opts: crate::store::init::Options,
) -> ExnResult<Self> {
std::fs::read_dir(&git_dir)
.or_raise_erased(|| Message::new("Could not access reference store").with("path", git_dir.as_path()))?;
Ok(crate::Store {
inner: crate::store::State::Loose {
store: file::Store::at_opts(git_dir, object_hash, opts),
},
})
}
}