repo/repository_diff.rs
1// SPDX-License-Identifier: Apache-2.0
2//! Tree diffing utilities.
3
4use objects::{
5 error::HeddleError,
6 object::{ContentHash, FileChangeSet, diff_trees},
7};
8
9use super::{Repository, Result};
10
11impl Repository {
12 /// Get the difference between two trees.
13 pub fn diff_trees(&self, from: &ContentHash, to: &ContentHash) -> Result<FileChangeSet> {
14 diff_trees(self.store.as_ref(), from, to)
15 .map_err(|error| HeddleError::InvalidObject(format!("tree diff failed: {error}")))
16 }
17}