def _initialize_repo(repo_name, repo_dir, config, progress=None):
"""
Clones repository and configures it to use sparse checkout.
Extraneous folders will get removed later using git read-tree
"""
util.logger.info('Repo {} doesn\'t exist. Cloning...'.format(repo_name))
# Clone repo
repo = git.Repo.clone_from(
config['GITHUB_ORG'] + repo_name,
repo_dir,
progress,
branch=config['REPO_BRANCH'],
)
# Use sparse checkout
config = repo.config_writer()
config.set_value('core', 'sparsecheckout', True)
config.release()
util.logger.info('Repo {} initialized'.format(repo_name))
评论列表
文章目录