Since the config was moved to go-gh this bug has been lurking around. The idea behind IsModified is that the config file shouldn't be written if only hosts has changed, and vice versa. Unfortunately, if there is a hosts file then on load of the files, the config entry would be SetModified as a result of having the hosts being added as an entry.
The consequence of this is that any call to Write would attempt to write the config file, even if only hosts had changed.
This PR sets the top level Config as unmodified to avoid that.
Testing notes
This command should not write to the config file:
gh config set --host github.com boo bar
You can set the config file as immutable on Mac like so:
Description
This PR relates to https://github.com/cli/cli/issues/8496
Since the config was moved to
go-gh
this bug has been lurking around. The idea behindIsModified
is that the config file shouldn't be written if only hosts has changed, and vice versa. Unfortunately, if there is a hosts file then on load of the files, the config entry would beSetModified
as a result of having the hosts being added as an entry.The consequence of this is that any call to
Write
would attempt to write the config file, even if only hosts had changed.This PR sets the top level Config as unmodified to avoid that.
Testing notes
This command should not write to the config file:
You can set the config file as immutable on Mac like so:
and revert it with: