Commit 46b87414 authored by hinoka@chromium.org's avatar hinoka@chromium.org

Pass shallow flag through gclient to git_cache.py

BUG=261741

Review URL: https://codereview.chromium.org/278043005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@270542 0039d316-1c4b-4281-b951-d872f2087c98
parent 73c31cd9
......@@ -1738,6 +1738,9 @@ def CMDsync(parser, args):
parser.add_option('--output-json',
help='Output a json document to this path containing '
'summary information about the sync.')
parser.add_option('--shallow', action='store_true',
help='GIT ONLY - Do a shallow clone into the cache dir. '
'Requires Git 1.9+')
(options, args) = parser.parse_args(args)
client = GClient.LoadCurrentConfig(options)
......
......@@ -765,7 +765,15 @@ class GitWrapper(SCMWrapper):
if hasattr(options, 'with_branch_heads') and options.with_branch_heads:
mirror_kwargs['refs'].append('refs/branch-heads/*')
mirror = git_cache.Mirror(url, **mirror_kwargs)
mirror.populate(verbose=options.verbose, bootstrap=True)
if options.shallow:
# HACK(hinoka): These repositories should be super shallow.
if 'flash' in url:
depth = 10
else:
depth = 10000
else:
depth = None
mirror.populate(verbose=options.verbose, bootstrap=True, depth=depth)
mirror.unlock()
return mirror.mirror_path if mirror.exists() else None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment