From 3a8a11d85f4faae7fff1eca6df50ca0980b7fddc Mon Sep 17 00:00:00 2001 From: Marius Gedminas Date: Tue, 21 Jun 2016 19:22:53 +0300 Subject: [PATCH] git: fix change testing when version is HEAD (#3025) When `version` is not specified, it defaults to "HEAD". "HEAD" is not a remote tag, and it's not listed in the output of get_branches(), so we'd keep repo_updated at the default value (None) and then return early with changed=True in --check mode, even when before == after. Fixes #3024. --- lib/ansible/modules/source_control/git.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/modules/source_control/git.py b/lib/ansible/modules/source_control/git.py index 4830e8ea67b..eec76e4133f 100644 --- a/lib/ansible/modules/source_control/git.py +++ b/lib/ansible/modules/source_control/git.py @@ -819,6 +819,8 @@ def main(): if local_mods: module.exit_json(changed=True, before=before, after=remote_head, msg="Local modifications exist") + elif version == 'HEAD': + repo_updated = False elif is_remote_tag(git_path, module, dest, repo, version): # if the remote is a tag and we have the tag locally, exit early if version in get_tags(git_path, module, dest):