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