def _get_git_root():
"""
Retrieve the git directory, or prompt to create one if not found
"""
git_root = None
try:
git_root = str(git('rev-parse', '--show-toplevel')).strip()
except ErrorReturnCode as e:
if e.exit_code != 128:
fatal(e.message, e.exit_code)
if not git_root:
warning('You must be in a git repository directory to '
'initialize a new project.')
if not click.confirm('Do you want to create a new git '
'repository here?', default=True):
fatal('Please run %s' % style('git init', bold=True))
try:
vgit('init')
git_root = os.getcwd()
except ErrorReturnCode as e:
fatal('An error occurred when trying to initialize a '
'new repo.', e.exit_code)
if git_root == aeriscloud_path:
fatal('You cannot init AerisCloud from the AerisCloud directory!')
return git_root
评论列表
文章目录