Skip to content

Commit

Permalink
git: fix change testing when version is HEAD (ansible#3025)
Browse files Browse the repository at this point in the history
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 ansible#3024.
  • Loading branch information
mgedmin authored and mattclay committed Dec 8, 2016
1 parent 3d5f84c commit 3a8a11d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ansible/modules/source_control/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 3a8a11d

Please sign in to comment.