Merge pull request #13502 from robinro/patch-3

use shallow clones by default in ansible-pull
This commit is contained in:
Brian Coca 2015-12-13 09:31:35 -05:00
commit 175c2d6510

View file

@ -80,6 +80,8 @@ class PullCLI(CLI):
help='directory to checkout repository to') help='directory to checkout repository to')
self.parser.add_option('-U', '--url', dest='url', default=None, self.parser.add_option('-U', '--url', dest='url', default=None,
help='URL of the playbook repository') help='URL of the playbook repository')
self.parser.add_option('--full', dest='fullclone', action='store_true',
help='Do a full clone, instead of a shallow one.')
self.parser.add_option('-C', '--checkout', dest='checkout', self.parser.add_option('-C', '--checkout', dest='checkout',
help='branch/tag/commit to checkout. ' 'Defaults to behavior of repository module.') help='branch/tag/commit to checkout. ' 'Defaults to behavior of repository module.')
self.parser.add_option('--accept-host-key', default=False, dest='accept_host_key', action='store_true', self.parser.add_option('--accept-host-key', default=False, dest='accept_host_key', action='store_true',
@ -155,6 +157,10 @@ class PullCLI(CLI):
if self.options.verify: if self.options.verify:
repo_opts += ' verify_commit=yes' repo_opts += ' verify_commit=yes'
if not self.options.fullclone:
repo_opts += ' depth=1'
path = module_loader.find_plugin(self.options.module_name) path = module_loader.find_plugin(self.options.module_name)
if path is None: if path is None:
raise AnsibleOptionsError(("module '%s' not found.\n" % self.options.module_name)) raise AnsibleOptionsError(("module '%s' not found.\n" % self.options.module_name))