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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
impl crate::Repository {
#[inline]
pub(crate) fn free_buf(&self) -> Vec<u8> {
self.bufs.borrow_mut().pop().unwrap_or_default()
}
#[inline]
pub(crate) fn reuse_buffer(&self, data: &mut Vec<u8>) {
if data.capacity() > 0 {
self.bufs.borrow_mut().push(std::mem::take(data));
}
}
}
impl crate::Repository {
pub fn committer(&self) -> git_actor::Signature {
git_actor::Signature::empty()
}
pub fn object_hash(&self) -> git_hash::Kind {
self.object_hash
}
}
mod init {
use std::cell::RefCell;
impl crate::Repository {
pub(crate) fn from_refs_and_objects(
refs: crate::RefStore,
objects: crate::OdbHandle,
object_hash: git_hash::Kind,
work_tree: Option<std::path::PathBuf>,
config: crate::Config,
) -> Self {
crate::Repository {
bufs: RefCell::new(Vec::with_capacity(4)),
object_hash,
work_tree,
objects: {
#[cfg(feature = "max-performance")]
{
objects.with_pack_cache(|| Box::new(git_pack::cache::lru::StaticLinkedList::<64>::default()))
}
#[cfg(not(feature = "max-performance"))]
{
objects
}
},
refs,
config,
}
}
pub fn into_sync(self) -> crate::ThreadSafeRepository {
self.into()
}
}
}
mod location;
mod snapshots;
mod impls;
mod cache;
mod config;
mod reference;
mod object;
mod thread_safe;