History

git-commitgraph uses `oid` now (#63)

Sebastian Thiel committed 5 years ago

Commit 0b729661 parent 3930a6f6 files · +35 −46Browse files

Showing the changes to git-commitgraph/tests/commitgraph.rs (1 of 6 files). Show all

Unified · Split

git-commitgraph/tests/commitgraph.rs+9−9
@@ -87,20 +87,20 @@ pub struct RefInfo { · 86 unmodified lines
8787 }
8888
8989 impl RefInfo {
90− pub fn id(&self) -> git_hash::borrowed::Id {
91− self.id.to_borrowed()
90+ pub fn id(&self) -> &git_hash::oid {
91+ &self.id
9292 }
9393
9494 pub fn pos(&self) -> GraphPosition {
9595 self.pos
9696 }
9797
98− pub fn parent_ids(&self) -> impl IntoIterator<Item = git_hash::borrowed::Id> {
99− self.parent_ids.iter().map(|x| x.to_borrowed())
98+ pub fn parent_ids(&self) -> impl IntoIterator<Item = &git_hash::oid> {
99+ self.parent_ids.iter().map(|x| x.as_ref())
100100 }
101101
102− pub fn root_tree_id(&self) -> git_hash::borrowed::Id {
103− self.root_tree_id.to_borrowed()
102+ pub fn root_tree_id(&self) -> &git_hash::oid {
103+ &self.root_tree_id
104104 }
105105 }
106106
@@ -135,9 +135,9 @@ pub fn inspect_refs(repo_dir: impl AsRef<Path>, refs: &[&'static str]) -> HashMa · 28 unmodified lines
135135 .collect();
136136 infos.sort_by_key(|x| x.1);
137137
138− let get_pos = |id: git_hash::borrowed::Id| -> GraphPosition {
138+ let get_pos = |id: &git_hash::oid| -> GraphPosition {
139139 let pos: u32 = infos
140− .binary_search_by_key(&id, |x| x.1.to_borrowed())
140+ .binary_search_by_key(&id, |x| &x.1)
141141 .expect("sorted_ids to contain id")
142142 .try_into()
143143 .expect("graph position to fit in u32");
@@ -154,7 +154,7 @@ pub fn inspect_refs(repo_dir: impl AsRef<Path>, refs: &[&'static str]) -> HashMa · 10 unmodified lines
154154 id,
155155 parent_ids,
156156 root_tree_id,
157− pos: get_pos(id.to_borrowed()),
157+ pos: get_pos(&id),
158158 },
159159 )
160160 })