aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/content-address.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-13 03:02:09 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-13 03:02:09 +0000
commitc466cb2091b7a382aba1739c0320f2b6c0a04c1e (patch)
tree0532aad8e8753b046b1309ef6f8f646bc279ef03 /src/libstore/content-address.cc
parent323d51a7a05d81c717d8e8673a78b07500a591fe (diff)
parent44157653850ce18536f837d7ed53521d61a238a1 (diff)
Merge branch 'hash-always-has-type' into better-ca-parse-errors
Diffstat (limited to 'src/libstore/content-address.cc')
-rw-r--r--src/libstore/content-address.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstore/content-address.cc b/src/libstore/content-address.cc
index 470cc62c9..a562f2d23 100644
--- a/src/libstore/content-address.cc
+++ b/src/libstore/content-address.cc
@@ -92,4 +92,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);
+}
+
}