Skip to main content

commit_is_byte_faithful

Function commit_is_byte_faithful 

Source
pub fn commit_is_byte_faithful(state: &State) -> bool
Expand description

Whether reconstructing state’s commit object from Heddle state alone is guaranteed byte-exact to the original commit — the precondition for the #567 reconstruct-from-state path. False for the two #564 lossy gaps:

  1. non-UTF8 author/committer identity bytes (see [identity_is_byte_faithful]);
  2. lossy imports, where unrepresentable tree entries were dropped/converted so the rebuilt tree — hence commit — OID diverges.

(2) is read off ONE canonical signal — State::git_lossy — that lossy import population paths set, rather than enumerating import surfaces or relying on Git Projection Mapping sidecar state. The state flag closes the whole class, including any future lossy entry point.

When false the caller MUST keep the verbatim residual / Bridge Mirror bytes / preserved mapped OID (or fall through to the native mint) rather than mint a wrong-SHA reconstructed object.

pub so the checkout write-through path (#568 P1, git_core::write_thread_state_checkout_from_existing_mirror) reads the SAME single faithful-or-lossy discriminator the export path does — reconstruct faithful commits from state, residual-then-mirror backstop the lossy residual. Keeping ONE chokepoint for the decision means a new consumer cannot drift to a different (wrong-SHA) rule.