From 00e1400eb741d4f5329a6bcfdc8946617967dcb1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 2 Apr 2020 11:55:41 +0200 Subject: [PATCH] Doh --- src/libfetchers/tree-info.cc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/libfetchers/tree-info.cc diff --git a/src/libfetchers/tree-info.cc b/src/libfetchers/tree-info.cc new file mode 100644 index 000000000..50795e162 --- /dev/null +++ b/src/libfetchers/tree-info.cc @@ -0,0 +1,26 @@ +#include "tree-info.hh" +#include "store-api.hh" + +#include + +namespace nix::fetchers { + +StorePath TreeInfo::computeStorePath(Store & store) const +{ + assert(narHash); + return store.makeFixedOutputPath(true, narHash, "source"); +} + +nlohmann::json TreeInfo::toJson() const +{ + nlohmann::json json; + assert(narHash); + json["narHash"] = narHash.to_string(SRI); + if (revCount) + json["revCount"] = *revCount; + if (lastModified) + json["lastModified"] = *lastModified; + return json; +} + +}