1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-04 11:21:47 +02:00

Renamed HashFormat::Base32 to HashFormat::Nix32

...and also adjusted parsing accordingly.

Also added CLI completion for HashFormats.

https://github.com/NixOS/nix/issues/8876
This commit is contained in:
Peter Kolloch 2023-11-28 15:38:15 +01:00
parent 837b889c41
commit fc6f29053a
30 changed files with 228 additions and 82 deletions

View file

@ -406,7 +406,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
auto info = store->queryPathInfo(j);
if (query == qHash) {
assert(info->narHash.algo == HashAlgorithm::SHA256);
cout << fmt("%s\n", info->narHash.to_string(HashFormat::Base32, true));
cout << fmt("%s\n", info->narHash.to_string(HashFormat::Nix32, true));
} else if (query == qSize)
cout << fmt("%d\n", info->narSize);
}
@ -769,8 +769,8 @@ static void opVerifyPath(Strings opFlags, Strings opArgs)
if (current.first != info->narHash) {
printError("path '%s' was modified! expected hash '%s', got '%s'",
store->printStorePath(path),
info->narHash.to_string(HashFormat::Base32, true),
current.first.to_string(HashFormat::Base32, true));
info->narHash.to_string(HashFormat::Nix32, true),
current.first.to_string(HashFormat::Nix32, true));
status = 1;
}
}
@ -898,7 +898,7 @@ static void opServe(Strings opFlags, Strings opArgs)
out << info->narSize // downloadSize
<< info->narSize;
if (GET_PROTOCOL_MINOR(clientVersion) >= 4)
out << info->narHash.to_string(HashFormat::Base32, true)
out << info->narHash.to_string(HashFormat::Nix32, true)
<< renderContentAddress(info->ca)
<< info->sigs;
} catch (InvalidPath &) {