History

rename 'Locate' to 'Find' - shorter and just as good

Sebastian Thiel committed 5 years ago

Commit 60f72f51 parent 5c791af24 files · +84 −81Browse files

Showing the changes to git-diff (1 of 24 files). Show all

Unified · Split

git-diff/tests/visit/mod.rs+10−10
@@ -4,7 +4,7 @@ mod changes { · 3 unmodified lines
44 use git_diff::visit::{recorder, recorder::Change::*};
55 use git_hash::{oid, ObjectId};
66 use git_object::{bstr::ByteSlice, immutable, tree::EntryMode};
7− use git_odb::{linked, pack, Locate};
7+ use git_odb::{linked, pack, Find};
88
99 fn db(args: impl IntoIterator<Item = &'static str>) -> crate::Result<linked::Db> {
1010 linked::Db::at(
@@ -21,7 +21,7 @@ mod changes { · 10 unmodified lines
2121 buf: &'a mut Vec<u8>,
2222 ) -> crate::Result<immutable::TreeIter<'a>> {
2323 let tree_id = db
24− .locate(commit, buf, &mut pack::cache::Never)?
24+ .find(commit, buf, &mut pack::cache::Never)?
2525 .ok_or_else(|| String::from(format!("start commit {:?} to be present", commit)))?
2626 .decode()?
2727 .into_commit()
@@ -29,7 +29,7 @@ mod changes { · 1 unmodified line
2929 .tree();
3030
3131 Ok(db
32− .locate(tree_id, buf, &mut pack::cache::Never)?
32+ .find(tree_id, buf, &mut pack::cache::Never)?
3333 .expect("main tree present")
3434 .into_tree_iter()
3535 .expect("id to be a tree"))
@@ -51,7 +51,7 @@ mod changes { · 15 unmodified lines
5151 rhs_tree,
5252 git_diff::visit::State::default(),
5353 |oid, buf| {
54− db.locate(oid, buf, &mut pack::cache::Never)
54+ db.find(oid, buf, &mut pack::cache::Never)
5555 .ok()
5656 .flatten()
5757 .and_then(|obj| obj.into_tree_iter())
@@ -65,7 +65,7 @@ mod changes { · 7 unmodified lines
6565 let mut buf = Vec::new();
6666 let (main_tree_id, parent_commit_id) = {
6767 let commit = db
68− .locate(commit_id, &mut buf, &mut pack::cache::Never)?
68+ .find(commit_id, &mut buf, &mut pack::cache::Never)?
6969 .ok_or_else(|| String::from(format!("start commit {:?} to be present", commit_id)))?
7070 .decode()?
7171 .into_commit()
@@ -77,18 +77,18 @@ mod changes { · 5 unmodified lines
7777 })
7878 };
7979 let current_tree = db
80− .locate(main_tree_id, &mut buf, &mut pack::cache::Never)?
80+ .find(main_tree_id, &mut buf, &mut pack::cache::Never)?
8181 .expect("main tree present")
8282 .into_tree_iter()
8383 .expect("id to be a tree");
8484 let mut buf2 = Vec::new();
8585 let previous_tree: Option<_> = {
8686 parent_commit_id
87− .and_then(|id| db.locate(id, &mut buf2, &mut pack::cache::Never).ok().flatten())
87+ .and_then(|id| db.find(id, &mut buf2, &mut pack::cache::Never).ok().flatten())
8888 .and_then(|c| c.decode().ok())
8989 .and_then(|c| c.into_commit())
9090 .map(|c| c.tree())
91− .and_then(|tree| db.locate(tree, &mut buf2, &mut pack::cache::Never).ok().flatten())
91+ .and_then(|tree| db.find(tree, &mut buf2, &mut pack::cache::Never).ok().flatten())
9292 .and_then(|tree| tree.into_tree_iter())
9393 };
9494
@@ -97,7 +97,7 @@ mod changes { · 2 unmodified lines
9797 current_tree,
9898 &mut git_diff::visit::State::default(),
9999 |oid, buf| {
100− db.locate(oid, buf, &mut pack::cache::Never)
100+ db.find(oid, buf, &mut pack::cache::Never)
101101 .ok()
102102 .flatten()
103103 .and_then(|obj| obj.into_tree_iter())
@@ -131,7 +131,7 @@ mod changes { · 27 unmodified lines
131131
132132 let head = head_of(db);
133133 iter::Ancestors::new(Some(head), iter::ancestors::State::default(), |oid, buf| {
134− db.locate(oid, buf, &mut pack::cache::Never)
134+ db.find(oid, buf, &mut pack::cache::Never)
135135 .ok()
136136 .flatten()
137137 .and_then(|o| o.into_commit_iter())