Skip to main content

write_commit_object

Function write_commit_object 

Source
pub fn write_commit_object(
    repo: &Repository,
    content: &[u8],
) -> GitResult<ObjectId>
Expand description

Frame + write a reconstructed commit object’s content bytes into repo’s object database, returning its git OID — the SHA-1 of the framed object (§0), equal to the original commit’s id exactly when content is byte-identical to the original.

This is the write side of export-from-state (#567): export regenerates each commit object from Heddle state and writes it here, rather than relying on the git mirror still holding the verbatim imported bytes — the dependency #568 removes. Idempotent: sley’s object writer hashes first and no-ops when the object already exists, so re-writing a commit the mirror already carries (the common case today) costs nothing.