git_ref/store/general/
init.rs1use std::path::PathBuf;
2
3use crate::store::WriteReflog;
4
5mod error {
6 #[derive(Debug, thiserror::Error)]
8 #[allow(missing_docs)]
9 pub enum Error {
10 #[error("There was an error accessing the store's directory")]
11 Io(#[from] std::io::Error),
12 }
13}
14
15pub use error::Error;
16
17use crate::file;
18
19#[allow(dead_code)]
20impl crate::Store {
21 pub fn at(
25 git_dir: impl Into<PathBuf>,
26 reflog_mode: WriteReflog,
27 object_hash: git_hash::Kind,
28 ) -> Result<Self, Error> {
29 let git_dir = git_dir.into();
31 std::fs::read_dir(&git_dir)?;
32 Ok(crate::Store {
33 inner: crate::store::State::Loose {
34 store: file::Store::at(git_dir, reflog_mode, object_hash),
35 },
36 })
37 }
38}