Skip to main content

diff_index_to_worktree

Function diff_index_to_worktree 

Source
pub fn diff_index_to_worktree(
    odb: &Odb,
    index: &Index,
    work_tree: &Path,
    ignore_submodule_untracked: bool,
    simplify_gitlinks: bool,
) -> Result<Vec<DiffEntry>>
Expand description

Compare the index against the working tree.

This shows “unstaged” changes — modifications not yet staged.

Entries with IndexEntry::assume_unchanged or IndexEntry::skip_worktree are treated as matching the work tree without examining the filesystem (Git CE_VALID / skip-worktree).

§Parameters

  • odb — object database (for hashing worktree files).
  • index — the current index.
  • work_tree — path to the working tree root.
  • ignore_submodule_untracked — when true, gitlink entries are not dirty solely from untracked files inside the submodule (matches git status -uno).
  • simplify_gitlinks — when true, nested gitlink entries only compare the submodule checkout HEAD to the recorded OID (ignore dirty work trees inside nested submodules). Used when computing submodule_porcelain_flags so untracked files under a nested submodule do not set the parent submodule’s modified bit (Git DIRTY_SUBMODULE_MODIFIED; t7506).

§Errors

Returns errors from I/O or hashing.