|
|
|
@ -99,7 +99,7 @@ def get_version(git_path, dest):
|
|
|
|
|
sha = sha[0].split()[1]
|
|
|
|
|
return sha
|
|
|
|
|
|
|
|
|
|
def clone(git_path, module, repo, dest, remote, depth):
|
|
|
|
|
def clone(git_path, module, repo, dest, remote, depth, version):
|
|
|
|
|
''' makes a new git repo if it does not already exist '''
|
|
|
|
|
dest_dirname = os.path.dirname(dest)
|
|
|
|
|
try:
|
|
|
|
@ -108,6 +108,8 @@ def clone(git_path, module, repo, dest, remote, depth):
|
|
|
|
|
pass
|
|
|
|
|
os.chdir(dest_dirname)
|
|
|
|
|
cmd = [ git_path, 'clone', '-o', remote, '--recursive' ]
|
|
|
|
|
if version:
|
|
|
|
|
cmd.extend([ '--branch', str(version) ])
|
|
|
|
|
if depth:
|
|
|
|
|
cmd.extend([ '--depth', str(depth) ])
|
|
|
|
|
cmd.extend([ repo, dest ])
|
|
|
|
@ -317,7 +319,7 @@ def main():
|
|
|
|
|
if not os.path.exists(gitconfig):
|
|
|
|
|
if module.check_mode:
|
|
|
|
|
module.exit_json(changed=True)
|
|
|
|
|
(rc, out, err) = clone(git_path, module, repo, dest, remote, depth)
|
|
|
|
|
(rc, out, err) = clone(git_path, module, repo, dest, remote, depth, version)
|
|
|
|
|
elif not update:
|
|
|
|
|
# Just return having found a repo already in the dest path
|
|
|
|
|
# this does no checking that the repo is the actual repo
|
|
|
|
|