From af62ce48876c09dfb7b32ca0f794ef3bb53d3ddf Mon Sep 17 00:00:00 2001 From: Eman Resu <78693624+quatquatt@users.noreply.github.com> Date: Thu, 21 May 2026 16:02:22 -0400 Subject: [PATCH] lib.generators.toGitINI: avoid creating several variables on every call --- lib/generators.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/generators.nix b/lib/generators.nix index 0b8393e8ebe2..9361404a5a0e 100644 --- a/lib/generators.nix +++ b/lib/generators.nix @@ -381,15 +381,17 @@ rec { toGitINI = let mkSectionName = + let + containsQuote = hasInfix ''"''; + in name: let - containsQuote = hasInfix ''"'' name; sections = splitString "." name; - section = head sections; - subsections = tail sections; - subsection = concatStringsSep "." subsections; in - if containsQuote || subsections == [ ] then name else ''${section} "${subsection}"''; + if containsQuote name || length sections == 1 then + name + else + ''${head sections} "${concatStringsSep "." (tail sections)}"''; mkValueString = v: