1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 18:31:49 +02:00

Add missing --hash-algo flag to nix store add

This commit is contained in:
John Ericson 2024-01-19 01:07:26 -05:00
parent 382fa51ff0
commit 356352c370
3 changed files with 14 additions and 2 deletions

View file

@ -22,6 +22,7 @@ struct CmdAddToStore : MixDryRun, StoreCommand
Path path;
std::optional<std::string> namePart;
ContentAddressMethod caMethod = FileIngestionMethod::Recursive;
HashAlgorithm hashAlgo = HashAlgorithm::SHA256;
CmdAddToStore()
{
@ -51,6 +52,8 @@ struct CmdAddToStore : MixDryRun, StoreCommand
this->caMethod = parseIngestionMethod(s);
}},
});
addFlag(Flag::mkHashAlgoFlag("hash-algo", &hashAlgo));
}
void run(ref<Store> store) override
@ -63,9 +66,9 @@ struct CmdAddToStore : MixDryRun, StoreCommand
auto storePath = dryRun
? store->computeStorePath(
*namePart, accessor, path2, caMethod, HashAlgorithm::SHA256, {}).first
*namePart, accessor, path2, caMethod, hashAlgo, {}).first
: store->addToStoreSlow(
*namePart, accessor, path2, caMethod, HashAlgorithm::SHA256, {}).path;
*namePart, accessor, path2, caMethod, hashAlgo, {}).path;
logger->cout("%s", store->printStorePath(storePath));
}