Skip to main content

detect_copies

Function detect_copies 

Source
pub fn detect_copies(
    odb: &Odb,
    work_root: Option<&Path>,
    entries: Vec<DiffEntry>,
    threshold: u32,
    find_copies_harder: bool,
    source_tree_entries: &[(String, String, ObjectId)],
) -> Vec<DiffEntry>
Expand description

Detect copies among diff entries.

This first runs rename detection (pairing Deleted+Added), then for any remaining Added entries, looks for copy sources.

  • find_copies_harder = false: only Modified entries are copy source candidates.
  • find_copies_harder = true: also examine unmodified files from source_tree_entries.

source_tree_entries should be a list of (path, mode, oid) from the source tree; used when find_copies_harder is true to consider unmodified files as copy sources.