diff options
author | Alois Wohlschlager <alois1@gmx-topmail.de> | 2024-07-15 18:24:16 +0200 |
---|---|---|
committer | Alois Wohlschlager <alois1@gmx-topmail.de> | 2024-07-18 18:41:34 +0200 |
commit | b5da823138023957d91eb013c2a6350ef6032a80 (patch) | |
tree | 09b1c6358e36112f737d262554f3b7dba8be393f /src | |
parent | 81a0624d7613dbd5a4fc69cde95314e7db47bd43 (diff) |
libexpr/print: never show empty attrsets or derivations as «repeated»
The repeated value detection logic exists so that the occurrence of large
common substructures does not fill up the screen or the computer's memory.
However, empty attribute sets and derivations (when their detection is enabled)
are always cheap to print, and in practice I have observed them to make up a
significant majority of the cases where I was annoyed by the repeated value
detection kicking in. Furthermore, `nix-instantiate --eval` already disables
this logic for empty attribute sets, and empty lists are already exempted
everywhere. For these reasons, always print empty attribute sets and
derivations as what they are.
Change-Id: I5dac8e7739f9d726b76fd0521ec46f38af94463f
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/print.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libexpr/print.cc b/src/libexpr/print.cc index 6eb321c43..2ee11d9d3 100644 --- a/src/libexpr/print.cc +++ b/src/libexpr/print.cc @@ -277,13 +277,10 @@ private: void printAttrs(Value & v, size_t depth) { - if (seen && !seen->insert(v.attrs).second) { - printRepeated(); - return; - } - if (options.force && options.derivationPaths && state.isDerivation(v)) { printDerivation(v); + } else if (seen && !v.attrs->empty() && !seen->insert(v.attrs).second) { + printRepeated(); } else if (depth < options.maxDepth) { increaseIndent(); output << "{"; |