1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 12:41:15 +02:00

dropEmptyInitThenConcatStringsSep -> concatStringSep: diagnostics and docs

These are non-critical, so their behavior is ok to change.
Dropping empty items is not needed and usually not expected.
This commit is contained in:
Robert Hensing 2024-07-12 23:06:32 +02:00
parent a681d354e7
commit ea966a70fc
9 changed files with 28 additions and 16 deletions

View file

@ -9,6 +9,8 @@
#include <iterator>
#include <nlohmann/json.hpp>
#include "strings.hh"
namespace nix::flake {
static FlakeRef getFlakeRef(
@ -61,7 +63,7 @@ static std::shared_ptr<Node> doFind(const ref<Node>& root, const InputPath & pat
std::vector<std::string> cycle;
std::transform(found, visited.cend(), std::back_inserter(cycle), printInputPath);
cycle.push_back(printInputPath(path));
throw Error("follow cycle detected: [%s]", dropEmptyInitThenConcatStringsSep(" -> ", cycle));
throw Error("follow cycle detected: [%s]", concatStringsSep(" -> ", cycle));
}
visited.push_back(path);
@ -367,7 +369,7 @@ void check();
std::string printInputPath(const InputPath & path)
{
return dropEmptyInitThenConcatStringsSep("/", path);
return concatStringsSep("/", path);
}
}