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 <vapier@google.com>
Tested-by: Raman Tenneti <rtenneti@google.com>
diff --git a/repo b/repo
index 768050e..80db98d 100755
--- a/repo
+++ b/repo
@@ -147,7 +147,7 @@
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 @@
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 86b7774..f16bee6 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -124,6 +124,10 @@
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 @@
'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 @@
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