History

refactor; better errors for invalid hash sizes(#63)

Sebastian Thiel committed 5 years ago

Commit be84b361 parent 6f9706318 files · +47 −43Browse files

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

Unified · Split

git-commitgraph/tests/commitgraph.rs+4−4
@@ -76,7 +76,7 @@ pub fn fixture_path(path: &str) -> PathBuf { · 75 unmodified lines
76}76}
77 77
78pub fn hex_to_id(hex: &[u8]) -> git_hash::ObjectId {78pub fn hex_to_id(hex: &[u8]) -> git_hash::ObjectId {
79 git_hash::ObjectId::from_40_bytes_in_hex(hex).expect("40 bytes hex")79 git_hash::ObjectId::from_hex(hex).expect("40 bytes hex")
80}80}
81 81
82pub struct RefInfo {82pub struct RefInfo {
@@ -124,11 +124,11 @@ pub fn inspect_refs(repo_dir: impl AsRef<Path>, refs: &[&'static str]) -> HashMa · 41 unmodified lines
124 let parts = x.trim_end().split(' ').collect::<Vec<_>>();124 let parts = x.trim_end().split(' ').collect::<Vec<_>>();
125 (125 (
126 parts[0].to_string(),126 parts[0].to_string(),
127 git_hash::ObjectId::from_40_bytes_in_hex(parts[1].as_bytes()).expect("40 bytes hex"),127 git_hash::ObjectId::from_hex(parts[1].as_bytes()).expect("40 bytes hex"),
128 git_hash::ObjectId::from_40_bytes_in_hex(parts[2].as_bytes()).expect("40 bytes hex"),128 git_hash::ObjectId::from_hex(parts[2].as_bytes()).expect("40 bytes hex"),
129 parts[3..]129 parts[3..]
130 .iter()130 .iter()
131 .map(|x| git_hash::ObjectId::from_40_bytes_in_hex(x.as_bytes()).expect("40 bytes hex"))131 .map(|x| git_hash::ObjectId::from_hex(x.as_bytes()).expect("40 bytes hex"))
132 .collect(),132 .collect(),
133 )133 )
134 })134 })