Something went wrong. Try again.
Monorepo for Tangled forked from tangled.org/core
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253//! Operations on a single commit-graph file.
use std::fmt::{Display, Formatter};
pub use self::commit::Commit;
mod access;pub mod commit;mod init;pub mod verify;
const COMMIT_DATA_ENTRY_SIZE_SANS_HASH: usize = 16;pub(crate) const FAN_LEN: usize = 256;const HEADER_LEN: usize = 8;
pub(crate) const SIGNATURE: &[u8] = b"CGPH";
pub(crate) type ChunkId = gix_chunk::Id;pub(crate) const BASE_GRAPHS_LIST_CHUNK_ID: ChunkId = *b"BASE";pub(crate) const BLOOM_FILTER_DATA_CHUNK_ID: ChunkId = *b"BDAT";pub(crate) const BLOOM_FILTER_INDEX_CHUNK_ID: ChunkId = *b"BIDX";const BLOOM_FILTER_HEADER_SIZE: usize = 3 * std::mem::size_of::<u32>();pub(crate) const COMMIT_DATA_CHUNK_ID: ChunkId = *b"CDAT";pub(crate) const EXTENDED_EDGES_LIST_CHUNK_ID: ChunkId = *b"EDGE";pub(crate) const GENERATION_DATA_CHUNK_ID: ChunkId = *b"GDA2";pub(crate) const GENERATION_DATA_OVERFLOW_CHUNK_ID: ChunkId = *b"GDO2";pub(crate) const OID_FAN_CHUNK_ID: ChunkId = *b"OIDF";pub(crate) const OID_LOOKUP_CHUNK_ID: ChunkId = *b"OIDL";
// Note that git's commit-graph-format.txt as of v2.28.0 gives an incorrect value 0x0700_0000 for// NO_PARENT. Fixed in https://github.com/git/git/commit/4d515253afcef985e94400adbfed7044959f9121 .pub(crate) const NO_PARENT: u32 = 0x7000_0000;pub(crate) const EXTENDED_EDGES_MASK: u32 = 0x8000_0000;pub(crate) const LAST_EXTENDED_EDGE_MASK: u32 = 0x8000_0000;pub(crate) const CORRECTED_COMMIT_DATE_OFFSET_OVERFLOW: u32 = 0x8000_0000;
/// The position of a given commit within a graph file, starting at 0.////// Commits within a graph file are sorted in lexicographical order by OID; a commit's lexicographical position/// is its position in this ordering. If a commit graph spans multiple files, each file's commits/// start at lexicographical position 0, so it is unique across a single file but is not unique across/// the whole commit graph. Each commit also has a graph position ([`Position`][crate::Position]),/// which is unique across the whole commit graph./// In order to avoid accidentally mixing lexicographical positions with graph positions, distinct types are used for each.#[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) }}