diff options
author | Mike Frysinger <vapier@google.com> | 2021-02-09 23:14:41 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2021-02-11 01:48:12 +0000 |
commit | 38867fb6d38d45a11271d6ef492e4d40066b078f (patch) | |
tree | 99778a43a5007322414ecd8b7c290842a4bc3fc6 /subcmds/init.py | |
parent | ce64e3d47b97e54cc7fac3d7577cd53f1857de26 (diff) | |
download | git-repo-38867fb6d38d45a11271d6ef492e4d40066b078f.tar.gz |
git_config: add SetBoolean helper
A little sugar simplifies the code a bit.
Change-Id: Ie2b8a965faa9f9ca05c7be479d03e8e073cd816d
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/296522
Reviewed-by: Raman Tenneti <rtenneti@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'subcmds/init.py')
-rw-r--r-- | subcmds/init.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index 1bcf5463..fe3ebd2c 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -250,7 +250,7 @@ to update the working directory files. | |||
250 | m.config.SetString('repo.reference', opt.reference) | 250 | m.config.SetString('repo.reference', opt.reference) |
251 | 251 | ||
252 | if opt.dissociate: | 252 | if opt.dissociate: |
253 | m.config.SetString('repo.dissociate', 'true') | 253 | m.config.SetBoolean('repo.dissociate', opt.dissociate) |
254 | 254 | ||
255 | if opt.worktree: | 255 | if opt.worktree: |
256 | if opt.mirror: | 256 | if opt.mirror: |
@@ -261,14 +261,14 @@ to update the working directory files. | |||
261 | print('fatal: --submodules and --worktree are incompatible', | 261 | print('fatal: --submodules and --worktree are incompatible', |
262 | file=sys.stderr) | 262 | file=sys.stderr) |
263 | sys.exit(1) | 263 | sys.exit(1) |
264 | m.config.SetString('repo.worktree', 'true') | 264 | m.config.SetBoolean('repo.worktree', opt.worktree) |
265 | if is_new: | 265 | if is_new: |
266 | m.use_git_worktrees = True | 266 | m.use_git_worktrees = True |
267 | print('warning: --worktree is experimental!', file=sys.stderr) | 267 | print('warning: --worktree is experimental!', file=sys.stderr) |
268 | 268 | ||
269 | if opt.archive: | 269 | if opt.archive: |
270 | if is_new: | 270 | if is_new: |
271 | m.config.SetString('repo.archive', 'true') | 271 | m.config.SetBoolean('repo.archive', opt.archive) |
272 | else: | 272 | else: |
273 | print('fatal: --archive is only supported when initializing a new ' | 273 | print('fatal: --archive is only supported when initializing a new ' |
274 | 'workspace.', file=sys.stderr) | 274 | 'workspace.', file=sys.stderr) |
@@ -278,7 +278,7 @@ to update the working directory files. | |||
278 | 278 | ||
279 | if opt.mirror: | 279 | if opt.mirror: |
280 | if is_new: | 280 | if is_new: |
281 | m.config.SetString('repo.mirror', 'true') | 281 | m.config.SetBoolean('repo.mirror', opt.mirror) |
282 | else: | 282 | else: |
283 | print('fatal: --mirror is only supported when initializing a new ' | 283 | print('fatal: --mirror is only supported when initializing a new ' |
284 | 'workspace.', file=sys.stderr) | 284 | 'workspace.', file=sys.stderr) |
@@ -291,7 +291,7 @@ to update the working directory files. | |||
291 | print('fatal: --mirror and --partial-clone are mutually exclusive', | 291 | print('fatal: --mirror and --partial-clone are mutually exclusive', |
292 | file=sys.stderr) | 292 | file=sys.stderr) |
293 | sys.exit(1) | 293 | sys.exit(1) |
294 | m.config.SetString('repo.partialclone', 'true') | 294 | m.config.SetBoolean('repo.partialclone', opt.partial_clone) |
295 | if opt.clone_filter: | 295 | if opt.clone_filter: |
296 | m.config.SetString('repo.clonefilter', opt.clone_filter) | 296 | m.config.SetString('repo.clonefilter', opt.clone_filter) |
297 | else: | 297 | else: |
@@ -300,10 +300,10 @@ to update the working directory files. | |||
300 | if opt.clone_bundle is None: | 300 | if opt.clone_bundle is None: |
301 | opt.clone_bundle = False if opt.partial_clone else True | 301 | opt.clone_bundle = False if opt.partial_clone else True |
302 | else: | 302 | else: |
303 | m.config.SetString('repo.clonebundle', 'true' if opt.clone_bundle else 'false') | 303 | m.config.SetBoolean('repo.clonebundle', opt.clone_bundle) |
304 | 304 | ||
305 | if opt.submodules: | 305 | if opt.submodules: |
306 | m.config.SetString('repo.submodules', 'true') | 306 | m.config.SetBoolean('repo.submodules', opt.submodules) |
307 | 307 | ||
308 | if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet, verbose=opt.verbose, | 308 | if not m.Sync_NetworkHalf(is_new=is_new, quiet=opt.quiet, verbose=opt.verbose, |
309 | clone_bundle=opt.clone_bundle, | 309 | clone_bundle=opt.clone_bundle, |