fix(nix-compat/nixhash): fix from_nix_nixbase32_str fn name
This was decoding nixbase32, not hex. Its only consumer (in ca_hash.rs) was right in its docstring about how it behaves, only was calling the wrongly-named function. Change-Id: I97ea273706ba818d16a61b1574989db800f78ead Reviewed-on: https://cl.snix.dev/c/snix/+/30553 Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com> Tested-by: besadii Autosubmit: Florian Klink <flokli@flokli.de>
This commit is contained in:
parent
80b5206034
commit
2a01c40e77
2 changed files with 6 additions and 6 deletions
|
|
@ -85,9 +85,9 @@ impl CAHash {
|
|||
}
|
||||
"fixed" => {
|
||||
if let Some(s) = s.strip_prefix("r:") {
|
||||
NixHash::from_nix_hex_str(s).map(CAHash::Nar)
|
||||
NixHash::from_nix_nixbase32_str(s).map(CAHash::Nar)
|
||||
} else {
|
||||
NixHash::from_nix_hex_str(s).map(CAHash::Flat)
|
||||
NixHash::from_nix_nixbase32_str(s).map(CAHash::Flat)
|
||||
}
|
||||
}
|
||||
_ => None,
|
||||
|
|
|
|||
|
|
@ -73,9 +73,9 @@ impl NixHash {
|
|||
}
|
||||
}
|
||||
|
||||
/// Constructs a [NixHash] from the Nix default hash format,
|
||||
/// the inverse of [Self::to_nix_hex_string].
|
||||
pub fn from_nix_hex_str(s: &str) -> Option<Self> {
|
||||
/// Constructs a new [NixHash] from the Nix default hash format,
|
||||
/// the inverse of [Self::to_nix_nixbase32_string].
|
||||
pub fn from_nix_nixbase32_str(s: &str) -> Option<Self> {
|
||||
let (tag, digest) = s.split_once(':')?;
|
||||
|
||||
(match tag {
|
||||
|
|
@ -98,7 +98,7 @@ impl NixHash {
|
|||
|
||||
/// Formats a [NixHash] in the format that's used inside CAHash,
|
||||
/// which is the algo, followed by a colon, then the nixbase32-encoded digest.
|
||||
pub(crate) fn to_nix_nixbase32_string(&self) -> String {
|
||||
pub fn to_nix_nixbase32_string(&self) -> String {
|
||||
format!(
|
||||
"{}:{}",
|
||||
self.algo(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue