gix_index/extension/mod.rs
1use bstr::BString;
2use smallvec::SmallVec;
3
4/// The size of the smallest possible extension, which is no more than a signature and a 0 indicating its size.
5pub const MIN_SIZE: usize = 4 /* signature */ + 4 /* size */;
6
7/// The kind of index extension.
8pub type Signature = [u8; 4];
9
10/// An iterator over the data of index extensions.
11pub struct Iter<'a> {
12 data: &'a [u8],
13 /// The amount of consumed bytes as seen from our internal data pointer. Useful to continue where the iterator left off.
14 pub consumed: usize,
15}
16
17/// A structure to associate object ids of a tree with sections in the index entries list.
18///
19/// It allows to more quickly build trees by avoiding as it can quickly reuse portions of the index and its associated tree ids
20/// if there was no change to them. Portions of this tree are invalidated as the index is changed.
21#[derive(PartialEq, Eq, Clone, Debug)]
22pub struct Tree {
23 /// The name of the tree/directory, or empty if it's the root tree.
24 pub name: SmallVec<[u8; 23]>,
25 /// The id of the directory tree of the associated tree object.
26 pub id: gix_hash::ObjectId,
27 /// The amount of non-tree items in this directory tree, including sub-trees, recursively.
28 /// The value of the top-level tree is thus equal to the value of the total amount of entries.
29 /// If `None`, the tree is considered invalid and needs to be refreshed
30 pub num_entries: Option<u32>,
31 /// The child-trees below the current tree.
32 pub children: Vec<Tree>,
33}
34
35/// The link extension to track a shared index.
36#[derive(Clone)]
37pub struct Link {
38 /// The checksum of the shared index as last seen.
39 pub shared_index_checksum: gix_hash::ObjectId,
40 /// Bitmaps to tell us which entries to delete or replace.
41 pub bitmaps: Option<link::Bitmaps>,
42}
43
44/// The extension for untracked files.
45#[allow(dead_code)]
46#[derive(Clone)]
47pub struct UntrackedCache {
48 /// Something identifying the location and machine that this cache is for.
49 /// Should the repository be copied to a different machine, the entire cache can immediately be invalidated.
50 identifier: BString,
51 /// Stat for the .git/info/exclude file
52 info_exclude: Option<untracked_cache::OidStat>,
53 /// Stat for the `core.excludesfile`
54 excludes_file: Option<untracked_cache::OidStat>,
55 /// Usually `.gitignore`
56 exclude_filename_per_dir: BString,
57 dir_flags: u32,
58
59 /// A list of directories and sub-directories, with `directories[0]` being the root.
60 directories: Vec<untracked_cache::Directory>,
61}
62
63/// The extension for keeping state on recent information provided by the filesystem monitor.
64#[allow(dead_code)]
65#[derive(Clone)]
66pub struct FsMonitor {
67 token: fs_monitor::Token,
68 /// if a bit is true, the respective entry is NOT valid as per the fs monitor.
69 entry_dirty: gix_bitmap::ewah::Vec,
70}
71
72mod iter;
73
74pub(crate) mod fs_monitor;
75
76///
77pub mod decode;
78
79///
80pub mod tree;
81
82///
83pub mod end_of_index_entry;
84
85pub(crate) mod index_entry_offset_table;
86
87///
88pub mod link;
89
90pub(crate) mod resolve_undo;
91
92///
93pub mod untracked_cache;
94
95///
96pub mod sparse;