aboutsummaryrefslogtreecommitdiff
path: root/src/nix/hash.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-02 23:30:38 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-06-03 04:44:24 +0000
commit3c78ac348c3a32fa6d78d3c56645901513c2e731 (patch)
treeb4ff0079484b825f884eb98ff88655142d386f58 /src/nix/hash.cc
parentfecff16a6e8bffce9a404b1508fec375e83ec01e (diff)
parent406dbb7fce32f7d80b02f560d91c956698b58d6e (diff)
Merge remote-tracking branch 'obsidian/no-hash-type-unknown' into validPathInfo-ca-proper-datatype
Diffstat (limited to 'src/nix/hash.cc')
-rw-r--r--src/nix/hash.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/nix/hash.cc b/src/nix/hash.cc
index 26bbcef1c..a36364f50 100644
--- a/src/nix/hash.cc
+++ b/src/nix/hash.cc
@@ -80,12 +80,12 @@ static RegisterCommand r2("hash-path", [](){ return make_ref<CmdHash>(FileIngest
struct CmdToBase : Command
{
Base base;
- HashType ht = HashType::Unknown;
+ 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);
}
@@ -133,8 +133,6 @@ static int compatNixHash(int argc, char * * argv)
else if (*arg == "--type") {
string s = getArg(*arg, arg, end);
ht = parseHashType(s);
- if (ht == HashType::Unknown)
- throw UsageError(format("unknown hash type '%1%'") % s);
}
else if (*arg == "--to-base16") op = opTo16;
else if (*arg == "--to-base32") op = opTo32;