git: fix the config output formatting
When setting values using the `git config --set` command, git formats the file a bit differently. This changes the output so it maps to that format. Differences: * each `key = value` in a section is prefixed by a tab character * the `=` between the key and the value is surrounded by spaces PR #1069
This commit is contained in:
parent
71c7aaee83
commit
9a1feb5b10
6 changed files with 40 additions and 37 deletions
|
@ -22,7 +22,7 @@ let
|
||||||
# generation for multiple ini values
|
# generation for multiple ini values
|
||||||
mkKeyValue = k: v:
|
mkKeyValue = k: v:
|
||||||
let mkKeyValue = generators.mkKeyValueDefault { } " = " k;
|
let mkKeyValue = generators.mkKeyValueDefault { } " = " k;
|
||||||
in concatStringsSep "\n" (map mkKeyValue (toList v));
|
in concatStringsSep "\n" (map (kv: " " + mkKeyValue kv) (toList v));
|
||||||
|
|
||||||
# converts { a.b.c = 5; } to { "a.b".c = 5; } for toINI
|
# converts { a.b.c = 5; } to { "a.b".c = 5; } for toINI
|
||||||
gitFlattenAttrs = let
|
gitFlattenAttrs = let
|
||||||
|
|
3
tests/modules/programs/git/git-expected-include.conf
Normal file
3
tests/modules/programs/git/git-expected-include.conf
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[user]
|
||||||
|
email = user@example.org
|
||||||
|
name = John Doe
|
|
@ -15,8 +15,8 @@ let
|
||||||
pkgs.substituteAll {
|
pkgs.substituteAll {
|
||||||
src = path;
|
src = path;
|
||||||
|
|
||||||
git_include_path =
|
git_include_path = pkgs.writeText "contents"
|
||||||
pkgs.writeText "contents" (generators.toINI { } gitInclude);
|
(builtins.readFile ./git-expected-include.conf);
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
Loading…
Reference in a new issue