mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
lib.generators.toGitINI: avoid creating several variables on every call
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user