diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-07-10 13:21:37 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-07-10 13:21:37 +0200 |
commit | 5dff49f661cd221fc457d1a4660cd36f28266dc5 (patch) | |
tree | 3011f404ec85f85e387a2acd26f2c80538631cc8 /src/libstore/content-address.cc | |
parent | 7f1a86d57c548b4db44f589ffae2f6491d3b2d4c (diff) |
Factor out commonality between nix-prefetch-url and nix-store --add-fixed
Diffstat (limited to 'src/libstore/content-address.cc')
-rw-r--r-- | src/libstore/content-address.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstore/content-address.cc b/src/libstore/content-address.cc index 3d753836f..6cb69d0a9 100644 --- a/src/libstore/content-address.cc +++ b/src/libstore/content-address.cc @@ -82,4 +82,16 @@ std::string renderContentAddress(std::optional<ContentAddress> ca) { return ca ? renderContentAddress(*ca) : ""; } +Hash getContentAddressHash(const ContentAddress & ca) +{ + return std::visit(overloaded { + [](TextHash th) { + return th.hash; + }, + [](FixedOutputHash fsh) { + return fsh.hash; + } + }, ca); +} + } |