Merge pull request #3158 from gitbutlerapp/diff-tree-to-working-dir-with-index

performance: diff tree to working dir with index
This commit is contained in:
Kiril Videlov 2024-03-21 00:13:04 +01:00 committed by GitHub
commit 33e861af42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -147,8 +147,11 @@ impl Repository {
old_tree: Option<&Tree<'_>>,
opts: Option<&mut git2::DiffOptions>,
) -> Result<git2::Diff<'_>> {
if let Ok(mut index) = self.0.index() {
index.update_all(vec!["*"], None)?;
}
self.0
.diff_tree_to_workdir(old_tree.map(Into::into), opts)
.diff_tree_to_workdir_with_index(old_tree.map(Into::into), opts)
.map_err(Into::into)
}