git_ref/store/file/loose/
mod.rs1use crate::{FullName, Kind, Target};
2
3#[derive(Debug, PartialOrd, PartialEq, Ord, Eq, Hash, Clone)]
5pub struct Reference {
6 pub name: FullName,
8 pub target: Target,
10}
11
12impl Reference {
13 pub fn kind(&self) -> Kind {
15 self.target.kind()
16 }
17}
18
19pub(crate) mod reflog;
21
22pub(crate) mod iter;
24pub mod reference;
26
27mod init {
28 use std::path::PathBuf;
29
30 use crate::store_impl::file;
31
32 impl file::Store {
33 pub fn at(git_dir: impl Into<PathBuf>, write_reflog: file::WriteReflog, object_hash: git_hash::Kind) -> Self {
37 file::Store {
38 git_dir: git_dir.into(),
39 common_dir: None,
40 write_reflog,
41 namespace: None,
42 packed: git_features::fs::MutableSnapshot::new().into(),
43 object_hash,
44 }
45 }
46
47 pub fn for_linked_worktree(
50 git_dir: impl Into<PathBuf>,
51 common_dir: impl Into<PathBuf>,
52 write_reflog: file::WriteReflog,
53 object_hash: git_hash::Kind,
54 ) -> Self {
55 file::Store {
56 git_dir: git_dir.into(),
57 common_dir: Some(common_dir.into()),
58 write_reflog,
59 namespace: None,
60 packed: git_features::fs::MutableSnapshot::new().into(),
61 object_hash,
62 }
63 }
64 }
65}