summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/init.py')
-rw-r--r--subcmds/init.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/subcmds/init.py b/subcmds/init.py
index 1c809ab4..eaa6da50 100644
--- a/subcmds/init.py
+++ b/subcmds/init.py
@@ -115,6 +115,13 @@ to update the working directory files.
115 g.add_option('--depth', type='int', default=None, 115 g.add_option('--depth', type='int', default=None,
116 dest='depth', 116 dest='depth',
117 help='create a shallow clone with given depth; see git clone') 117 help='create a shallow clone with given depth; see git clone')
118 g.add_option('--partial-clone', action='store_true',
119 dest='partial_clone',
120 help='perform partial clone (https://git-scm.com/'
121 'docs/gitrepository-layout#_code_partialclone_code)')
122 g.add_option('--clone-filter', action='store', default='blob:none',
123 dest='clone_filter',
124 help='filter for use with --partial-clone [default: %default]')
118 g.add_option('--archive', 125 g.add_option('--archive',
119 dest='archive', action='store_true', 126 dest='archive', action='store_true',
120 help='checkout an archive instead of a git repository for ' 127 help='checkout an archive instead of a git repository for '
@@ -253,13 +260,25 @@ to update the working directory files.
253 'in another location.', file=sys.stderr) 260 'in another location.', file=sys.stderr)
254 sys.exit(1) 261 sys.exit(1)
255 262
263 if opt.partial_clone:
264 if opt.mirror:
265 print('fatal: --mirror and --partial-clone are mutually exclusive',
266 file=sys.stderr)
267 sys.exit(1)
268 m.config.SetString('repo.partialclone', 'true')
269 if opt.clone_filter:
270 m.config.SetString('repo.clonefilter', opt.clone_filter)
271 else:
272 opt.clone_filter = None
273
256 if opt.submodules: 274 if opt.submodules:
257 m.config.SetString('repo.submodules', 'true') 275 m.config.SetString('repo.submodules', 'true')
258 276
259 if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet, 277 if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet,
260 clone_bundle=not opt.no_clone_bundle, 278 clone_bundle=not opt.no_clone_bundle,
261 current_branch_only=opt.current_branch_only, 279 current_branch_only=opt.current_branch_only,
262 no_tags=opt.no_tags, submodules=opt.submodules): 280 no_tags=opt.no_tags, submodules=opt.submodules,
281 clone_filter=opt.clone_filter):
263 r = m.GetRemote(m.remote.name) 282 r = m.GetRemote(m.remote.name)
264 print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr) 283 print('fatal: cannot obtain manifest %s' % r.url, file=sys.stderr)
265 284