From f6c30fedf457f213ccc50a083477dc4d0b094194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elmeri=20Niemel=C3=A4?= <36383311+elmeriniemela@users.noreply.github.com> Date: Wed, 24 Jun 2020 07:42:37 +0300 Subject: [PATCH] Fix fallback to unshallowing shallow clone Currently git may not find the correct commit with depth=1000000 and shallow clone, caused by an error in the final fall back if clause. The comment in the if clause is correct, just missing a 'not' operator for the comment / behavior to work. --- lib/ansible/modules/git.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ansible/modules/git.py b/lib/ansible/modules/git.py index 14d26195461..ab07d03aa08 100644 --- a/lib/ansible/modules/git.py +++ b/lib/ansible/modules/git.py @@ -898,7 +898,7 @@ def fetch(git_path, module, repo, dest, version, remote, depth, bare, refspec, g refspecs.append('+refs/heads/%s:refs/remotes/%s/%s' % (version, remote, version)) elif is_remote_tag(git_path, module, dest, repo, version): refspecs.append('+refs/tags/' + version + ':refs/tags/' + version) - if refspecs: + if not refspecs: # if refspecs is empty, i.e. version is neither heads nor tags # assume it is a version hash # fall back to a full clone, otherwise we might not be able to checkout