Skip to main content

diff_index_to_tree

Function diff_index_to_tree 

Source
pub fn diff_index_to_tree(
    odb: &Odb,
    index: &Index,
    tree_oid: Option<&ObjectId>,
    ignore_submodules: bool,
) -> Result<Vec<DiffEntry>>
Expand description

Compare the index against a tree (usually HEAD’s tree).

This shows “staged” changes — what would be committed.

§Parameters

  • odb — object database.
  • index — the current index.
  • tree_oid — the tree to compare against (e.g. HEAD’s tree), or None for comparison against an empty tree (initial commit).

§Errors

Returns errors from ODB reads.

When ignore_submodules is true, gitlink (160000) paths are omitted from the diff, matching Git’s require_clean_work_tree(..., ignore_submodules=1) used by git rebase / git pull.