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
87}87}
88 88
89impl RefInfo {89impl RefInfo {
90 pub fn id(&self) -> git_hash::borrowed::Id {90 pub fn id(&self) -> &git_hash::oid {
91 self.id.to_borrowed()91 &self.id
92 }92 }
93 93
94 pub fn pos(&self) -> GraphPosition {94 pub fn pos(&self) -> GraphPosition {
95 self.pos95 self.pos
96 }96 }
97 97
98 pub fn parent_ids(&self) -> impl IntoIterator<Item = git_hash::borrowed::Id> {98 pub fn parent_ids(&self) -> impl IntoIterator<Item = &git_hash::oid> {
99 self.parent_ids.iter().map(|x| x.to_borrowed())99 self.parent_ids.iter().map(|x| x.as_ref())
100 }100 }
101 101
102 pub fn root_tree_id(&self) -> git_hash::borrowed::Id {102 pub fn root_tree_id(&self) -> &git_hash::oid {
103 self.root_tree_id.to_borrowed()103 &self.root_tree_id
104 }104 }
105}105}
106 106
@@ -135,9 +135,9 @@ pub fn inspect_refs(repo_dir: impl AsRef<Path>, refs: &[&'static str]) -> HashMa · 28 unmodified lines
135 .collect();135 .collect();
136 infos.sort_by_key(|x| x.1);136 infos.sort_by_key(|x| x.1);
137 137
138 let get_pos = |id: git_hash::borrowed::Id| -> GraphPosition {138 let get_pos = |id: &git_hash::oid| -> GraphPosition {
139 let pos: u32 = infos139 let pos: u32 = infos
140 .binary_search_by_key(&id, |x| x.1.to_borrowed())140 .binary_search_by_key(&id, |x| &x.1)
141 .expect("sorted_ids to contain id")141 .expect("sorted_ids to contain id")
142 .try_into()142 .try_into()
143 .expect("graph position to fit in u32");143 .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
154 id,154 id,
155 parent_ids,155 parent_ids,
156 root_tree_id,156 root_tree_id,
157 pos: get_pos(id.to_borrowed()),157 pos: get_pos(&id),
158 },158 },
159 )159 )
160 })160 })