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>
This commit is contained in:
Raman Tenneti 2021-04-02 10:55:33 -07:00
parent beea5de842
commit 6a2f4fb390
2 changed files with 11 additions and 2 deletions

5
repo
View File

@ -147,7 +147,7 @@ if not REPO_REV:
REPO_REV = 'stable' REPO_REV = 'stable'
# increment this whenever we make important changes to this script # 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 # increment this if the MAINTAINER_KEYS block is modified
KEYRING_VERSION = (2, 3) KEYRING_VERSION = (2, 3)
@ -314,6 +314,9 @@ def GetParser(gitc_init=False):
group.add_option('--partial-clone', action='store_true', group.add_option('--partial-clone', action='store_true',
help='perform partial clone (https://git-scm.com/' help='perform partial clone (https://git-scm.com/'
'docs/gitrepository-layout#_code_partialclone_code)') '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', group.add_option('--clone-filter', action='store', default='blob:none',
help='filter for use with --partial-clone ' help='filter for use with --partial-clone '
'[default: %default]') '[default: %default]')

View File

@ -124,6 +124,10 @@ to update the working directory files.
dest='partial_clone', dest='partial_clone',
help='perform partial clone (https://git-scm.com/' help='perform partial clone (https://git-scm.com/'
'docs/gitrepository-layout#_code_partialclone_code)') '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', g.add_option('--clone-filter', action='store', default='blob:none',
dest='clone_filter', dest='clone_filter',
help='filter for use with --partial-clone [default: %default]') 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) 'in another location.', file=sys.stderr)
sys.exit(1) sys.exit(1)
if opt.partial_clone: if opt.partial_clone is not None:
if opt.mirror: if opt.mirror:
print('fatal: --mirror and --partial-clone are mutually exclusive', print('fatal: --mirror and --partial-clone are mutually exclusive',
file=sys.stderr) file=sys.stderr)
@ -319,6 +323,8 @@ to update the working directory files.
m.config.SetBoolean('repo.partialclone', opt.partial_clone) m.config.SetBoolean('repo.partialclone', opt.partial_clone)
if opt.clone_filter: if opt.clone_filter:
m.config.SetString('repo.clonefilter', 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: else:
opt.clone_filter = None opt.clone_filter = None