From 6a2f4fb39073a4e2e6824d5f2f4a1cbf5fe4b766 Mon Sep 17 00:00:00 2001 From: Raman Tenneti Date: Fri, 2 Apr 2021 10:55:33 -0700 Subject: [PATCH] repo init: Added --no-partial-clone and made it persist. Bumped version to 2.14. Saved the repo.partialclone when --no-partial-clone option is passed to init, so repo sync will honor the no-partial-clone option. $ ./run_tests -v Bug: [google internal] b/175712967 $ mkdir androidx-main && cd androidx-main $ repo init -u https://android.googlesource.com/platform/manifest -b androidx-main --partial-clone --clone-filter=blob:limit=10M $ repo sync -c -j32 $ cd frameworks/support/ && /google/bin/releases/android/git_repack/git_unpartial $ git config -l | grep 'partialclonefilter=blob' Observe partialclone is not enabled. $ cd ../.. $ repo init -u https://android.googlesource.com/platform/manifest -b androidx-main $ repo sync -c -j32 $ cd frameworks/support/ && git config -l | grep 'partialclonefilter=blob' Observe partialclone is enabled. $ /google/bin/releases/android/git_repack/git_unpartial Observe partialclone is not enabled. $ cd ../.. $ repo_dev init -u https://android.googlesource.com/platform/manifest -b androidx-main --no-partial-clone $ repo sync -c -j32 $ cd frameworks/support/ && git config -l | grep 'partialclonefilter=blob' Observe partialclone is not enabled. Change-Id: I4400ad7803b106319856bcd0fffe00bafcdf014e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/302122 Reviewed-by: Mike Frysinger Tested-by: Raman Tenneti --- repo | 5 ++++- subcmds/init.py | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/repo b/repo index 768050ea..80db98d2 100755 --- a/repo +++ b/repo @@ -147,7 +147,7 @@ if not REPO_REV: REPO_REV = 'stable' # increment this whenever we make important changes to this script -VERSION = (2, 12) +VERSION = (2, 14) # increment this if the MAINTAINER_KEYS block is modified KEYRING_VERSION = (2, 3) @@ -314,6 +314,9 @@ def GetParser(gitc_init=False): group.add_option('--partial-clone', action='store_true', help='perform partial clone (https://git-scm.com/' 'docs/gitrepository-layout#_code_partialclone_code)') + group.add_option('--no-partial-clone', action='store_false', + help='disable use of partial clone (https://git-scm.com/' + 'docs/gitrepository-layout#_code_partialclone_code)') group.add_option('--clone-filter', action='store', default='blob:none', help='filter for use with --partial-clone ' '[default: %default]') diff --git a/subcmds/init.py b/subcmds/init.py index 86b77742..f16bee6d 100644 --- a/subcmds/init.py +++ b/subcmds/init.py @@ -124,6 +124,10 @@ to update the working directory files. dest='partial_clone', help='perform partial clone (https://git-scm.com/' 'docs/gitrepository-layout#_code_partialclone_code)') + g.add_option('--no-partial-clone', action='store_false', + dest='partial_clone', + help='disable use of partial clone (https://git-scm.com/' + 'docs/gitrepository-layout#_code_partialclone_code)') g.add_option('--clone-filter', action='store', default='blob:none', dest='clone_filter', help='filter for use with --partial-clone [default: %default]') @@ -311,7 +315,7 @@ to update the working directory files. 'in another location.', file=sys.stderr) sys.exit(1) - if opt.partial_clone: + if opt.partial_clone is not None: if opt.mirror: print('fatal: --mirror and --partial-clone are mutually exclusive', file=sys.stderr) @@ -319,6 +323,8 @@ to update the working directory files. m.config.SetBoolean('repo.partialclone', opt.partial_clone) if opt.clone_filter: m.config.SetString('repo.clonefilter', opt.clone_filter) + elif m.config.GetBoolean('repo.partialclone'): + opt.clone_filter = m.config.GetString('repo.clonefilter') else: opt.clone_filter = None