Jump to…
snowinitial commitqoxwzsukwmkx1mo
Matt W1//! `df-index` — reconstruction of jj semantics from pushed Git objects.
Matt W2//!
Matt W3//! Dogfood never runs the `jj` binary. A `jj git push` is an ordinary Git push;
Matt W4//! this crate reads jj's metadata back out of the pushed commit objects and
Matt W5//! turns it into the change index the product is built on.
Matt W6//!
Matt W7//! The crate is deliberately free of any Git library dependency. Everything
Matt W8//! here operates on raw bytes and plain data, which keeps `gix` confined to
Matt W9//! `df-store` (spec §3 rule 1) and makes the format-sensitive logic testable
Matt W10//! against byte literals captured from real repositories.
Matt W11
Matt W12pub mod change_id;
Matt W13pub mod indexer;
Matt W14pub mod synthetic;
Matt W15
Matt W16pub use change_id::{
Matt W17 extract_change_id, extract_conflict_trees, is_conflict_artifact, ChangeId, ConflictTrees,
Matt W18};
Matt W19pub use indexer::{line_map, rebase_anchor, stack_edges, AnchorOutcome, IndexedCommit, NewLine, StackEdge};
Matt W20pub use synthetic::{normalise_diff, synthetic_change_id, PatchIdentity, SyntheticId};
Matt W21
Matt W22/// The identity assigned to an indexed commit.
Matt W23///
Matt W24/// Every commit gets one. Which variant it is determines whether the UI shows a
Matt W25/// change chip and how much revision history Dogfood can promise (spec §4).
Matt W26#[derive(Debug, Clone, PartialEq, Eq)]
Matt W27pub enum Identity {
Matt W28 /// A real jj change id, read from the commit's `change-id` header.
Matt W29 Change(ChangeId),
Matt W30 /// A patch-derived identity for a commit authored by plain git.
Matt W31 Synthetic(SyntheticId),
Matt W32}
Matt W33
Matt W34impl Identity {
Matt W35 /// The canonical string stored in `changes.change_id`.
Matt W36 pub fn as_str(&self) -> &str {
Matt W37 match self {
Matt W38 Identity::Change(c) => c.as_str(),
Matt W39 Identity::Synthetic(s) => s.as_str(),
Matt W40 }
Matt W41 }
Matt W42
Matt W43 /// Whether this identity is synthesised rather than authored by jj.
Matt W44 /// Maps directly to `changes.synthetic`.
Matt W45 pub fn is_synthetic(&self) -> bool {
Matt W46 matches!(self, Identity::Synthetic(_))
Matt W47 }
Matt W48}

48 lines · Rust