Function rebuild_tree

Source
pub fn rebuild_tree<'r>(
    repo: &'r Repository,
    tree: Option<&Tree<'r>>,
    entries: HashMap<PathBuf, Option<(Oid, i32)>>,
) -> Result<Oid, Error>
Expand description

Add the provided entries into the tree.

If the provided Tree is None, then this function adds the entries to the empty tree.

The paths for the provided entries can contain slashes.

If the value for an entry is None, then that element in the tree is removed. If a directory ever becomes empty, then it’s removed from its parent directory.

If a path for a given entry is already present in the provided tree, then that entry is overwritten.

If a path refers to intermediate directories that don’t exist in the provided tree, then those intermediate directories are created.