From 79c22557ce0aea1ee8f3a58192c2c76087ccd3d8 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 20 Sep 2022 08:05:38 +0800 Subject: [PATCH] rename!: `Tree::lookup_path()` -> `Tree::lookup_entry()`. (#470) --- git-repository/src/object/tree/mod.rs | 6 +++--- git-repository/src/repository/snapshots.rs | 2 +- git-repository/src/revision/spec/parse/delegate/navigate.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/git-repository/src/object/tree/mod.rs b/git-repository/src/object/tree/mod.rs index cb4a6f9ecb..7418dcba97 100644 --- a/git-repository/src/object/tree/mod.rs +++ b/git-repository/src/object/tree/mod.rs @@ -31,7 +31,7 @@ impl<'repo> Tree<'repo> { /// Searching tree entries is currently done in sequence, which allows to the search to be allocation free. It would be possible /// to re-use a vector and use a binary search instead, which might be able to improve performance over all. /// However, a benchmark should be created first to have some data and see which trade-off to choose here. - pub fn lookup_path(mut self, path: I) -> Result, find::existing::Error> + pub fn lookup_entry(mut self, path: I) -> Result, find::existing::Error> where I: IntoIterator, P: PartialEq, @@ -67,11 +67,11 @@ impl<'repo> Tree<'repo> { /// /// If any path component contains illformed UTF-8 and thus can't be converted to bytes on platforms which can't do so natively, /// the returned component will be empty which makes the lookup fail. - pub fn lookup_path_by_path( + pub fn lookup_entry_by_path( self, relative_path: impl AsRef, ) -> Result, find::existing::Error> { - self.lookup_path( + self.lookup_entry( relative_path .as_ref() .components() diff --git a/git-repository/src/repository/snapshots.rs b/git-repository/src/repository/snapshots.rs index 527228828a..6795a9a942 100644 --- a/git-repository/src/repository/snapshots.rs +++ b/git-repository/src/repository/snapshots.rs @@ -42,7 +42,7 @@ impl crate::Repository { self.head().ok().and_then(|mut head| { let commit = head.peel_to_commit_in_place().ok()?; let tree = commit.tree().ok()?; - tree.lookup_path(Some(".mailmap")).ok()?.map(|e| e.oid) + tree.lookup_entry(Some(".mailmap")).ok()?.map(|e| e.oid) }) }); } diff --git a/git-repository/src/revision/spec/parse/delegate/navigate.rs b/git-repository/src/revision/spec/parse/delegate/navigate.rs index 35433a6e73..2605a40dd5 100644 --- a/git-repository/src/revision/spec/parse/delegate/navigate.rs +++ b/git-repository/src/revision/spec/parse/delegate/navigate.rs @@ -125,7 +125,7 @@ impl<'repo> delegate::Navigate for Delegate<'repo> { } let tree = repo.find_object(tree_id)?.into_tree(); let entry = - tree.lookup_path_by_path(git_path::from_bstr(path))? + tree.lookup_entry_by_path(git_path::from_bstr(path))? .ok_or_else(|| Error::PathNotFound { path: path.into(), object: obj.attach(repo).shorten_or_id(),