git_config: fix state=absent if value is present (#8452)

* Fix state=absent if value is present.

* Update changelog fragment.
This commit is contained in:
Felix Fontein 2024-06-06 07:35:54 +02:00 committed by GitHub
parent 0129346eda
commit 2a3819a696
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 1 deletions

View file

@ -252,7 +252,7 @@ def main():
module.exit_json(changed=False, msg='', config_value=old_values[0] if old_values else '')
elif unset and not out:
module.exit_json(changed=False, msg='no setting to unset')
elif new_value in old_values and (len(old_values) == 1 or add_mode == "add"):
elif new_value in old_values and (len(old_values) == 1 or add_mode == "add") and not unset:
module.exit_json(changed=False, msg="")
# Until this point, the git config was just read and in case no change is needed, the module has already exited.