def clone(git_path, module, repo, dest, remote, depth, version, bare, reference, refspec, verify_commit):
 dest_dirname = os.path.dirname(dest)
 try:
  os.makedirs(dest_dirname)
 except:
  pass
 cmd = [git_path, 'clone']
 if bare:
  cmd.append('--bare')
 else:
  cmd.extend(['--origin', remote])
 if depth:
  if ((version == 'HEAD') or refspec or is_remote_branch(git_path, module, dest, repo, version) or is_remote_tag(git_path, module, dest, repo, version)):
   cmd.extend(['--depth', str(depth)])
 if reference:
  cmd.extend(['--reference', str(reference)])
 cmd.extend([repo, dest])
 module.run_command(cmd, check_rc=True, cwd=dest_dirname)
 if bare:
  if (remote != 'origin'):
   module.run_command([git_path, 'remote', 'add', remote, repo], check_rc=True, cwd=dest)
 if refspec:
  cmd = [git_path, 'fetch']
  if depth:
   cmd.extend(['--depth', str(depth)])
  cmd.extend([remote, refspec])
  module.run_command(cmd, check_rc=True, cwd=dest)
 if verify_commit:
  verify_commit_sign(git_path, module, dest, version)

def clone ( git_path , module , repo , dest , remote , depth , version , bare , reference , refspec , verify_commit ) : dest_dirname = os . path . dirname ( dest ) try : os . makedirs ( dest_dirname ) except : pass cmd = [ git_path , 'clone' ] if bare : cmd . append ( '--bare' ) else : cmd . extend ( [ '--origin' , remote ] ) if depth : if ( ( version == 'HEAD' ) or refspec or is_remote_branch ( git_path , module , dest , repo , version ) or is_remote_tag ( git_path , module , dest , repo , version ) ) : cmd . extend ( [ '--depth' , str ( depth ) ] ) if reference : cmd . extend ( [ '--reference' , str ( reference ) ] ) cmd . extend ( [ repo , dest ] ) module . run_command ( cmd , check_rc = True , cwd = dest_dirname ) if bare : if ( remote != 'origin' ) : module . run_command ( [ git_path , 'remote' , 'add' , remote , repo ] , check_rc = True , cwd = dest ) if refspec : cmd = [ git_path , 'fetch' ] if depth : cmd . extend ( [ '--depth' , str ( depth ) ] ) cmd . extend ( [ remote , refspec ] ) module . run_command ( cmd , check_rc = True , cwd = dest ) if verify_commit : verify_commit_sign ( git_path , module , dest , version )
clone a remote git repository into a new directory .