pub fn build_tree(
repo: &Path,
base: Option<&str>,
changes: &BTreeMap<String, String>,
) -> Result<String, SyncError>Expand description
Builds a new tree incrementally and returns its object SHA.
When base is Some, the new tree starts from that ref or tree-ish and only
the paths in changes are overwritten or added. Unchanged entries keep their
existing blob objects, giving content-addressed dedup so the repository grows
by near zero per sync. When base is None, the tree is built from scratch.
changes maps each path (for example sessions/<uuid>.enc or meta/salt)
to the blob SHA that should live at that path. Nested paths are handled
automatically.
Internally this uses a throwaway index file via GIT_INDEX_FILE so the
user’s real index is never touched.