aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-06-19 14:40:49 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2020-06-19 14:40:49 -0400
commit7e11cf339988a1b44bbd59377de2a1585387ac83 (patch)
treecdce4ecf309a84408b4e3952daa7f78c9b825f5b /src/nix
parent2796b01e863bf3a6d28cc89bb46c6388d8b73fbc (diff)
parent984e521392b3f41f7cdab203e5c00f3e00e27a28 (diff)
Merge remote-tracking branch 'origin/master' into substitute-other-storedir
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/hash.cc6
-rw-r--r--src/nix/verify.cc4
2 files changed, 4 insertions, 6 deletions
diff --git a/src/nix/hash.cc b/src/nix/hash.cc
index 0dd4998d9..f435192fc 100644
--- a/src/nix/hash.cc
+++ b/src/nix/hash.cc
@@ -79,12 +79,12 @@ static RegisterCommand r2("hash-path", [](){ return make_ref<CmdHash>(FileIngest
struct CmdToBase : Command
{
Base base;
- HashType ht = htUnknown;
+ std::optional<HashType> ht;
std::vector<std::string> args;
CmdToBase(Base base) : base(base)
{
- addFlag(Flag::mkHashTypeFlag("type", &ht));
+ addFlag(Flag::mkHashTypeOptFlag("type", &ht));
expectArgs("strings", &args);
}
@@ -132,8 +132,6 @@ static int compatNixHash(int argc, char * * argv)
else if (*arg == "--type") {
string s = getArg(*arg, arg, end);
ht = parseHashType(s);
- if (ht == htUnknown)
- throw UsageError("unknown hash type '%1%'", s);
}
else if (*arg == "--to-base16") op = opTo16;
else if (*arg == "--to-base32") op = opTo32;
diff --git a/src/nix/verify.cc b/src/nix/verify.cc
index ab83637dc..d1aba08e3 100644
--- a/src/nix/verify.cc
+++ b/src/nix/verify.cc
@@ -88,9 +88,9 @@ struct CmdVerify : StorePathsCommand
std::unique_ptr<AbstractHashSink> hashSink;
if (info->ca == "")
- hashSink = std::make_unique<HashSink>(info->narHash.type);
+ hashSink = std::make_unique<HashSink>(*info->narHash.type);
else
- hashSink = std::make_unique<HashModuloSink>(info->narHash.type, std::string(info->path.hashPart()));
+ hashSink = std::make_unique<HashModuloSink>(*info->narHash.type, std::string(info->path.hashPart()));
store->narFromPath(info->path, *hashSink);