1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

git: Don't add --branch while cloning if the version is a SHA-1 hash.

This commit is contained in:
Yap Sok Ann 2013-10-16 20:31:25 +08:00
parent 9f8cdac0aa
commit 8519d586ba

View file

@ -122,8 +122,9 @@ def clone(git_path, module, repo, dest, remote, depth, version):
pass
os.chdir(dest_dirname)
cmd = [ git_path, 'clone', '-o', remote, '--recursive' ]
if version and version != 'HEAD':
cmd.extend([ '--branch', str(version) ])
if is_remote_branch(git_path, module, dest, repo, version) \
or is_remote_tag(git_path, module, dest, repo, version):
cmd.extend([ '--branch', version ])
if depth:
cmd.extend([ '--depth', str(depth) ])
cmd.extend([ repo, dest ])