From adef77b31fe260326803965ce7098c27faf136bd Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Tue, 10 May 2022 09:15:56 -0700 Subject: [PATCH] Implement `Tree::get_name` using `Tree::get_name_bytes` to avoid duplication --- src/tree.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/tree.rs b/src/tree.rs index cac66198d1..3d6b290c52 100644 --- a/src/tree.rs +++ b/src/tree.rs @@ -165,15 +165,7 @@ impl<'repo> Tree<'repo> { /// Lookup a tree entry by its filename pub fn get_name(&self, filename: &str) -> Option> { - let filename = CString::new(filename).unwrap(); - unsafe { - let ptr = call!(raw::git_tree_entry_byname(&*self.raw(), filename)); - if ptr.is_null() { - None - } else { - Some(entry_from_raw_const(ptr)) - } - } + self.get_name_bytes(filename.as_bytes()) } /// Lookup a tree entry by its filename, specified as bytes.