Skip to content

Commit 7d12405

Browse files
authored
add binding for git_apply_to_tree (rust-lang#720)
1 parent b055a28 commit 7d12405

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/repo.rs

+20
Original file line numberDiff line numberDiff line change
@@ -2891,6 +2891,26 @@ impl Repository {
28912891
}
28922892
}
28932893

2894+
/// Apply a Diff to the provided tree, and return the resulting Index.
2895+
pub fn apply_to_tree(
2896+
&self,
2897+
tree: &Tree<'_>,
2898+
diff: &Diff<'_>,
2899+
options: Option<&mut ApplyOptions<'_>>,
2900+
) -> Result<Index, Error> {
2901+
let mut ret = ptr::null_mut();
2902+
unsafe {
2903+
try_call!(raw::git_apply_to_tree(
2904+
&mut ret,
2905+
self.raw,
2906+
tree.raw(),
2907+
diff.raw(),
2908+
options.map(|s| s.raw()).unwrap_or(ptr::null())
2909+
));
2910+
Ok(Binding::from_raw(ret))
2911+
}
2912+
}
2913+
28942914
/// Reverts the given commit, producing changes in the index and working directory.
28952915
pub fn revert(
28962916
&self,

0 commit comments

Comments
 (0)