]>
Commit | Line | Data |
---|---|---|
0a29b90c FG |
1 | //! |
2 | ||
fe692bf9 FG |
3 | /// The kind of repository. |
4 | #[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)] | |
5 | pub enum Kind { | |
6 | /// A submodule worktree, whose `git` repository lives in `.git/modules/**/<name>` of the parent repository. | |
7 | Submodule, | |
8 | /// A bare repository does not have a work tree, that is files on disk beyond the `git` repository itself. | |
9 | Bare, | |
10 | /// A `git` repository along with a checked out files in a work tree. | |
11 | WorkTree { | |
12 | /// If true, this is the git dir associated with this _linked_ worktree, otherwise it is a repository with _main_ worktree. | |
13 | is_linked: bool, | |
14 | }, | |
15 | } | |
16 | ||
0a29b90c FG |
17 | /// Internal |
18 | impl crate::Repository { | |
19 | #[inline] | |
20 | pub(crate) fn free_buf(&self) -> Vec<u8> { | |
21 | self.bufs.borrow_mut().pop().unwrap_or_default() | |
22 | } | |
23 | ||
24 | /// This method is commonly called from the destructor of objects that previously claimed an entry | |
25 | /// in the free-list with `free_buf()`. | |
26 | /// They are welcome to take out the data themselves, for instance when the object is detached, to avoid | |
27 | /// it to be reclaimed. | |
28 | #[inline] | |
29 | pub(crate) fn reuse_buffer(&self, data: &mut Vec<u8>) { | |
30 | if data.capacity() > 0 { | |
31 | self.bufs.borrow_mut().push(std::mem::take(data)); | |
32 | } | |
33 | } | |
34 | } | |
35 | ||
49aad941 | 36 | mod attributes; |
0a29b90c FG |
37 | mod cache; |
38 | mod config; | |
49aad941 | 39 | mod excludes; |
fe692bf9 | 40 | mod graph; |
0a29b90c FG |
41 | pub(crate) mod identity; |
42 | mod impls; | |
43 | mod init; | |
fe692bf9 | 44 | mod kind; |
0a29b90c FG |
45 | mod location; |
46 | mod object; | |
0a29b90c FG |
47 | mod reference; |
48 | mod remote; | |
49 | mod revision; | |
49aad941 | 50 | mod shallow; |
0a29b90c FG |
51 | mod snapshots; |
52 | mod state; | |
53 | mod thread_safe; | |
54 | mod worktree; |