Skip to main content

git_zero_core/pack/
index_entry.rs

1use crate::ObjectId;
2
3/// Metadata for one complete encoded pack entry. Offsets include the pack header;
4/// CRCs cover its type/length header and complete zlib stream. An index's entries
5/// must be unique and sorted by ID. Fields do not authenticate a foreign pack.
6#[derive(Clone, Copy, Debug, Eq, PartialEq)]
7pub struct IndexEntry {
8    pub id: ObjectId,
9    pub offset: u64,
10    pub crc32: u32,
11}
12
13impl IndexEntry {
14    /// Initial value for caller-owned metadata arrays; overwritten during encoding.
15    pub const EMPTY: Self = Self {
16        id: ObjectId::Sha1([0; 20]),
17        offset: 0,
18        crc32: 0,
19    };
20}