Skip to content

Commit 6316180

Browse files
committed
Implement Tree::get_name using Tree::get_name_bytes to avoid duplication
1 parent 23a5340 commit 6316180

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/tree.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,7 @@ impl<'repo> Tree<'repo> {
165165

166166
/// Lookup a tree entry by its filename
167167
pub fn get_name(&self, filename: &str) -> Option<TreeEntry<'_>> {
168-
let filename = CString::new(filename).unwrap();
169-
unsafe {
170-
let ptr = call!(raw::git_tree_entry_byname(&*self.raw(), filename));
171-
if ptr.is_null() {
172-
None
173-
} else {
174-
Some(entry_from_raw_const(ptr))
175-
}
176-
}
168+
self.get_name_bytes(filename.as_bytes())
177169
}
178170

179171
/// Lookup a tree entry by its filename, specified as bytes.

0 commit comments

Comments
 (0)