nix-store --gc --print-roots: Sort output

This commit is contained in:
Eelco Dolstra 2019-03-14 13:59:10 +01:00
parent 578ed7a259
commit 86f3b94c8c
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -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 {