1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-10 20:46:01 +01:00

diff-closures: use removed / added words

This commit is contained in:
Graham Christensen 2025-06-02 11:13:03 -04:00
parent 724d552b64
commit 1500e541f2
2 changed files with 7 additions and 2 deletions

View file

@ -97,8 +97,13 @@ void printClosureDiff(
if (showDelta || !removed.empty() || !added.empty()) {
std::vector<std::string> items;
if (!removed.empty() || !added.empty())
if (!removed.empty() && !added.empty()) {
items.push_back(fmt("%s → %s", showVersions(removed), showVersions(added)));
} else if (!removed.empty()) {
items.push_back(fmt("%s removed", showVersions(removed)));
} else if (!added.empty()) {
items.push_back(fmt("%s added", showVersions(added)));
}
if (showDelta)
items.push_back(fmt("%s%+.1f KiB" ANSI_NORMAL, sizeDelta > 0 ? ANSI_RED : ANSI_GREEN, sizeDelta / 1024.0));
logger->cout("%s%s: %s", indent, name, concatStringsSep(", ", items));

View file

@ -58,7 +58,7 @@ nix profile list | grep -A4 'Name:.*flake1' | grep 'Locked flake URL:.*narHash'
[ -e $TEST_HOME/.nix-profile/share/man ]
(! [ -e $TEST_HOME/.nix-profile/include ])
nix profile history
nix profile history | grep "packages.$system.default: 1.0 added"
nix profile history | grep "packages.$system.default: 1.0, 1.0-man added"
nix profile diff-closures | grep 'env-manifest.nix: (no version) removed'
# Test XDG Base Directories support