From 86f3b94c8c28defd7402245d60af15ce429986ff Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 14 Mar 2019 13:59:10 +0100 Subject: nix-store --gc --print-roots: Sort output --- src/nix-store/nix-store.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 6f315e5093da..f324056bb3a1 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -592,9 +592,13 @@ static void opGC(Strings opFlags, Strings opArgs) if (printRoots) { Roots roots = store->findRoots(false); + std::set> 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 { -- cgit 1.4.1