Set method does not work if the UserName resource parameter contains whitespace. The method isn't also idempotent with multiple runs. Looking at the code, it occurs at this line:
PowerShell will strip the quotation marks when passing the string param. A quick fix would be to quote the param properly before sending it to Invoke-GitConfig
The global user.name value should be set properly.
Actual behavior
The command argument is passed as git config --global user.name Hello World when it should be passed as git config --global user.name 'Hello World'. This causes the name to be set improperly and by running the Set method multiple times it adds multiple name values in .gitconfig which breaks its idempotency.
Brief description of your issue
Set
method does not work if the UserName resource parameter contains whitespace. The method isn't also idempotent with multiple runs. Looking at the code, it occurs at this line:https://github.com/microsoft/winget-dsc/blob/ce47d703cb00a0e24f6de9d5c560df25c2f2d845/resources/GitDsc/GitDsc.psm1#L246
PowerShell will strip the quotation marks when passing the string param. A quick fix would be to quote the param properly before sending it to Invoke-GitConfig
Steps to reproduce
User a UserName value with whitespaces
Expected behavior
The global user.name value should be set properly.
Actual behavior
The command argument is passed as
git config --global user.name Hello World
when it should be passed asgit config --global user.name 'Hello World'
. This causes the name to be set improperly and by running the Set method multiple times it adds multiple name values in.gitconfig
which breaks its idempotency.gitconfig output with by running
Set
twice.Environment