From d79a4bc51b6ca5b47bbea861143c72bccc0ad13a Mon Sep 17 00:00:00 2001 From: Xin Li Date: Wed, 20 May 2020 16:03:45 -0700 Subject: Make partial clone imply no-clone-bundle by default. For large projects, clone bundle is useful because it provided a way to efficiently transfer a large portion of git objects through CDN, without needing to interact with git server. However, with partial clones, the intention is to not download most of the objects, so the use of clone bundles would defeat the space savings normally seen with partial clones, as they are downloaded before the first fetch. A new option, --clone-bundle is added to override this behavior. Add a new repo.clonebundle variable which remembers the choice if explicitly given from command line at repo init. Change-Id: I03638474af303a82af34579e16cd4700690b5f43 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/268452 Tested-by: Xin Li Reviewed-by: Jonathan Nieder --- subcmds/init.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'subcmds/init.py') diff --git a/subcmds/init.py b/subcmds/init.py index ce8b0187..eb82e2e4 100644 --- a/subcmds/init.py +++ b/subcmds/init.py @@ -155,9 +155,11 @@ to update the working directory files. help='restrict manifest projects to ones with a specified ' 'platform group [auto|all|none|linux|darwin|...]', metavar='PLATFORM') + g.add_option('--clone-bundle', action='store_true', + help='force use of /clone.bundle on HTTP/HTTPS (default if not --partial-clone)') g.add_option('--no-clone-bundle', - dest='clone_bundle', default=True, action='store_false', - help='disable use of /clone.bundle on HTTP/HTTPS') + dest='clone_bundle', action='store_false', + help='disable use of /clone.bundle on HTTP/HTTPS (default if --partial-clone)') g.add_option('--no-tags', dest='tags', default=True, action='store_false', help="don't fetch tags in the manifest") @@ -303,6 +305,11 @@ to update the working directory files. else: opt.clone_filter = None + if opt.clone_bundle is None: + opt.clone_bundle = False if opt.partial_clone else True + else: + m.config.SetString('repo.clonebundle', 'true' if opt.clone_bundle else 'false') + if opt.submodules: m.config.SetString('repo.submodules', 'true') -- cgit v1.2.3-54-g00ecf