diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-07-15 21:22:55 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-07-15 21:22:55 +0000 |
commit | 64b7421741110b28d4b31bfed3b2ff3ddb2234c2 (patch) | |
tree | 99e052bb54da3a6657da4338fb19866c7ffa5940 | |
parent | aff69e229cb584c852980738d7d46cdbdd9aaf59 (diff) | |
parent | d087cf48552ee82e2bc78bb6c99854bab350ee00 (diff) |
Merge branch 'handle-flat-case' into from-dump-stream
-rw-r--r-- | src/nix/why-depends.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nix/why-depends.cc b/src/nix/why-depends.cc index 167c974ee..49da01c0a 100644 --- a/src/nix/why-depends.cc +++ b/src/nix/why-depends.cc @@ -106,7 +106,11 @@ struct CmdWhyDepends : SourceExprCommand std::map<StorePath, Node> graph; for (auto & path : closure) - graph.emplace(path, Node { .path = path, .refs = store->queryPathInfo(path)->references }); + graph.emplace(path, Node { + .path = path, + .refs = store->queryPathInfo(path)->references, + .dist = path == dependencyPath ? 0 : inf + }); // Transpose the graph. for (auto & node : graph) @@ -115,8 +119,6 @@ struct CmdWhyDepends : SourceExprCommand /* Run Dijkstra's shortest path algorithm to get the distance of every path in the closure to 'dependency'. */ - graph.emplace(dependencyPath, Node { .path = dependencyPath, .dist = 0 }); - std::priority_queue<Node *> queue; queue.push(&graph.at(dependencyPath)); |