git: quote sendemail section header
This will allow, e.g., the character `@` in the email identity. Also adds a test case. Fixes #557
This commit is contained in:
parent
02a5a678f6
commit
45cadbd4f3
5 changed files with 77 additions and 1 deletions
33
tests/modules/programs/git-with-email.nix
Normal file
33
tests/modules/programs/git-with-email.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
imports = [ ../accounts/email-test-accounts.nix ];
|
||||
|
||||
config = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userEmail = "hm@example.com";
|
||||
userName = "H. M. Test";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
function assertGitConfig() {
|
||||
local value
|
||||
value=$(${pkgs.git}/bin/git config \
|
||||
--file $TESTED/home-files/.config/git/config \
|
||||
--get $1)
|
||||
if [[ $value != $2 ]]; then
|
||||
fail "Expected option '$1' to have value '$2' but it was '$value'"
|
||||
fi
|
||||
}
|
||||
|
||||
assertFileExists home-files/.config/git/config
|
||||
assertFileContent home-files/.config/git/config ${./git-with-email-expected.conf}
|
||||
|
||||
assertGitConfig "sendemail.hm@example.com.from" "hm@example.com"
|
||||
assertGitConfig "sendemail.hm-account.from" "hm@example.org"
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue