From 7d1240514f8b5a2de935bf2b5ae20229257b943f Mon Sep 17 00:00:00 2001 From: Waleed Khan Date: Mon, 14 Jun 2021 07:18:48 -0700 Subject: [PATCH] add binding for `git_apply_to_tree` (#720) --- src/repo.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/repo.rs b/src/repo.rs index 1304ecd74f..43cf49f1e5 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -2891,6 +2891,26 @@ impl Repository { } } + /// Apply a Diff to the provided tree, and return the resulting Index. + pub fn apply_to_tree( + &self, + tree: &Tree<'_>, + diff: &Diff<'_>, + options: Option<&mut ApplyOptions<'_>>, + ) -> Result { + let mut ret = ptr::null_mut(); + unsafe { + try_call!(raw::git_apply_to_tree( + &mut ret, + self.raw, + tree.raw(), + diff.raw(), + options.map(|s| s.raw()).unwrap_or(ptr::null()) + )); + Ok(Binding::from_raw(ret)) + } + } + /// Reverts the given commit, producing changes in the index and working directory. pub fn revert( &self,