Skip to main content

compute_patch_ids_from_text

Function compute_patch_ids_from_text 

Source
pub fn compute_patch_ids_from_text(
    input: &[u8],
    mode: PatchIdMode,
) -> Vec<(ObjectId, ObjectId)>
Expand description

Compute patch-IDs from unified diff text (e.g. git log -p output).

Parses the text line by line. Each time a commit <oid> or From <oid> … marker is found the accumulated hash for the previous patch is finalised and emitted as (patch_id, commit_id). Commits with no diff content (empty patches, merge commits) are silently skipped.

§Parameters

  • input — raw bytes of the unified diff stream.
  • mode — which patch-ID algorithm to use (see PatchIdMode).

§Returns

A Vec of (patch_id, commit_id) pairs in the order they were encountered in the stream.