lib.generators.toGitINI: avoid creating several variables on every call

This commit is contained in:
Eman Resu
2026-05-21 16:02:22 -04:00
parent 48a99a99fc
commit af62ce4887

View File

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