Skip to main content

write_tree_partial_from_index

Function write_tree_partial_from_index 

Source
pub fn write_tree_partial_from_index(
    odb: &Odb,
    index: &Index,
    base_tree_oid: &ObjectId,
    paths_from_index: &HashSet<Vec<u8>>,
) -> Result<ObjectId>
Expand description

Build a tree for a partial commit: paths listed in paths_from_index (repository-relative, UTF-8 path bytes) are taken from index; every other path is copied from base_tree_oid (typically HEAD^{tree}).

This matches Git’s behaviour when committing with pathspecs while the index contains additional staged paths: the commit tree merges HEAD with only the pathspec-selected index updates.