def clone(self, repo, ref, deps=()):
if os.path.isdir(repo):<EOL><INDENT>repo = os.path.abspath(repo)<EOL><DEDENT>def clone_strategy(directory):<EOL><INDENT>env = git.no_git_env()<EOL>def _git_cmd(*args):<EOL><INDENT>cmd_output('<STR_LIT>', *args, cwd=directory, env=env)<EOL><DEDENT>_git_cmd('<STR_LIT>', '<STR_LIT:.>')<EOL>_git_cmd('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', repo)<EOL>try:<EOL><INDENT>self._shallow_clone(ref, _git_cmd)<EOL><DEDENT>except CalledProcessError:<EOL><INDENT>self._complete_clone(ref, _git_cmd)<EOL><DEDENT><DEDENT>return self._new_repo(repo, ref, deps, clone_strategy)<EOL>
Clone the given url and checkout the specific ref.