diff --git a/changelogs/fragments/72405-git-module-local_mods-show-conflict-destination-directory.yml b/changelogs/fragments/72405-git-module-local_mods-show-conflict-destination-directory.yml new file mode 100644 index 00000000000..62926405f2a --- /dev/null +++ b/changelogs/fragments/72405-git-module-local_mods-show-conflict-destination-directory.yml @@ -0,0 +1,2 @@ +minor_changes: + - git - display the destination directory path in error msg when local_mods detects local modifications conflict so that users see the exact location diff --git a/lib/ansible/modules/git.py b/lib/ansible/modules/git.py index 85c8869ae90..30ad143b8a1 100644 --- a/lib/ansible/modules/git.py +++ b/lib/ansible/modules/git.py @@ -1304,11 +1304,11 @@ def main(): if local_mods: # failure should happen regardless of check mode if not force: - module.fail_json(msg="Local modifications exist in repository (force=no).", **result) + module.fail_json(msg="Local modifications exist in the destination: " + dest + " (force=no).", **result) # if force and in non-check mode, do a reset if not module.check_mode: reset(git_path, module, dest) - result.update(changed=True, msg='Local modifications exist.') + result.update(changed=True, msg='Local modifications exist in the destination: ' + dest) # exit if already at desired sha version if module.check_mode: