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
mod access;
pub mod commit;
pub use commit::Commit;
mod init;
pub mod verify;
pub use init::Error;
use filebuffer::FileBuffer;
use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;
use std::{
fmt::{Display, Formatter},
ops::Range,
path::PathBuf,
};
const COMMIT_DATA_ENTRY_SIZE: usize = SHA1_SIZE + 16;
const FAN_LEN: usize = 256;
const SIGNATURE: &[u8] = b"CGPH";
pub struct File {
base_graph_count: u8,
base_graphs_list_offset: Option<usize>,
commit_data_offset: usize,
data: FileBuffer,
extra_edges_list_range: Option<Range<usize>>,
fan: [u32; FAN_LEN],
oid_lookup_offset: usize,
path: PathBuf,
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Position(pub u32);
impl Display for Position {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
self.0.fmt(f)
}
}