diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-06-03T11·58+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-06-03T11·58+0200 |
commit | a8dfdc52b83eb12f174366aae173c37da66943b6 (patch) | |
tree | f2ff3801ddb93e6d1f278c7786603fe3acc39fb6 /src/libstore/misc.cc | |
parent | 75361b6dcef4c02cf3f9972c0d5a5a2726a1c438 (diff) | |
parent | c87a56f4d01442ee94c0db9e89a89292d44015ae (diff) |
Merge pull request #925 from abbradar/master
Show both cycle ends
Diffstat (limited to 'src/libstore/misc.cc')
-rw-r--r-- | src/libstore/misc.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstore/misc.cc b/src/libstore/misc.cc index 114ab565e08c..3ad93991d9e4 100644 --- a/src/libstore/misc.cc +++ b/src/libstore/misc.cc @@ -169,11 +169,11 @@ Paths Store::topoSortPaths(const PathSet & paths) Paths sorted; PathSet visited, parents; - std::function<void(const Path & path)> dfsVisit; + std::function<void(const Path & path, const Path * parent)> dfsVisit; - dfsVisit = [&](const Path & path) { + dfsVisit = [&](const Path & path, const Path * parent) { if (parents.find(path) != parents.end()) - throw BuildError(format("cycle detected in the references of ‘%1%’") % path); + throw BuildError(format("cycle detected in the references of '%1%' from '%2%'") % path % *parent); if (visited.find(path) != visited.end()) return; visited.insert(path); @@ -189,14 +189,14 @@ Paths Store::topoSortPaths(const PathSet & paths) /* Don't traverse into paths that don't exist. That can happen due to substitutes for non-existent paths. */ if (i != path && paths.find(i) != paths.end()) - dfsVisit(i); + dfsVisit(i, &path); sorted.push_front(path); parents.erase(path); }; for (auto & i : paths) - dfsVisit(i); + dfsVisit(i, nullptr); return sorted; } |