From 8519d586baf6f2ca6da57b936faec7fd44ae8acd Mon Sep 17 00:00:00 2001 From: Yap Sok Ann Date: Wed, 16 Oct 2013 20:31:25 +0800 Subject: [PATCH] git: Don't add --branch while cloning if the version is a SHA-1 hash. --- library/source_control/git | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/source_control/git b/library/source_control/git index a22c9cabdf..c241b8b5e6 100644 --- a/library/source_control/git +++ b/library/source_control/git @@ -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 ])