Skip to main content

compute_patch_id_for_paths

Function compute_patch_id_for_paths 

Source
pub fn compute_patch_id_for_paths(
    algo: HashAlgo,
    odb: &Odb,
    commit_oid: &ObjectId,
    paths: &[String],
    mode: PatchIdMode,
) -> Result<Option<ObjectId>>
Expand description

Compute the patch-ID for a single commit, limited to matching pathspecs.

This follows compute_patch_id semantics, but ignores file diffs whose old and new paths do not match paths.

§Parameters

  • algo — object hash algorithm (must match odb’s configured format).
  • odb — object database used to read commit, tree, and blob objects.
  • commit_oid — OID of the commit to compute the patch-ID for.
  • paths — pathspec strings used to limit the files included in the diff.
  • mode — accumulation and whitespace rules for the patch-ID.

§Errors

Returns errors from object-database reads or object-parse failures.