From db41a0616a42f8fb52b189f7fd05c2f09764426f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 13 Feb 2024 11:14:49 -0500 Subject: [PATCH] Use `ContentAddressMethod::render` in one more place Good to deduplicate the code. --- src/libfetchers/fetch-to-store.cc | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/libfetchers/fetch-to-store.cc b/src/libfetchers/fetch-to-store.cc index 196489e05..c27880662 100644 --- a/src/libfetchers/fetch-to-store.cc +++ b/src/libfetchers/fetch-to-store.cc @@ -21,23 +21,9 @@ StorePath fetchToStore( cacheKey = fetchers::Attrs{ {"_what", "fetchToStore"}, {"store", store.storeDir}, - {"name", std::string(name)}, + {"name", std::string{name}}, {"fingerprint", *path.accessor->fingerprint}, - { - "method", - std::visit(overloaded { - [](const TextIngestionMethod &) { - return "text"; - }, - [](const FileIngestionMethod & fim) { - switch (fim) { - case FileIngestionMethod::Flat: return "flat"; - case FileIngestionMethod::Recursive: return "nar"; - default: assert(false); - } - }, - }, method.raw), - }, + {"method", std::string{method.render()}}, {"path", path.path.abs()} }; if (auto res = fetchers::getCache()->lookup(store, *cacheKey)) {