Skip to content

Commit

Permalink
nix-store --gc --print-roots: Sort output
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Mar 14, 2019
1 parent 578ed7a commit 86f3b94
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/nix-store/nix-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,13 @@ static void opGC(Strings opFlags, Strings opArgs)

if (printRoots) {
Roots roots = store->findRoots(false);
std::set<std::pair<Path, Path>> roots2;
// Transpose and sort the roots.
for (auto & [target, links] : roots)
for (auto & link : links)
cout << link << " -> " << target << std::endl;
roots2.emplace(link, target);
for (auto & [link, target] : roots2)
std::cout << link << " -> " << target << "\n";
}

else {
Expand Down

0 comments on commit 86f3b94

Please sign in to comment.