update: synchronize submodules by default
This will keep the URL of each submodule up to date if they change. Allow users to get the old behavior via a new update.sync-submodules config option, which defaults to True but can be set to False. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
parent
c5617a0315
commit
e02ac52236
|
@ -821,6 +821,8 @@ class Update(_ProjectCommand):
|
||||||
fallback=None)
|
fallback=None)
|
||||||
self.name_cache = args.name_cache or config.get('update', 'name-cache',
|
self.name_cache = args.name_cache or config.get('update', 'name-cache',
|
||||||
fallback=None)
|
fallback=None)
|
||||||
|
self.sync_submodules = config.getboolean('update', 'sync-submodules',
|
||||||
|
fallback=True)
|
||||||
|
|
||||||
self.group_filter: List[str] = []
|
self.group_filter: List[str] = []
|
||||||
|
|
||||||
|
@ -1002,11 +1004,16 @@ class Update(_ProjectCommand):
|
||||||
# For the list type, update given list of submodules.
|
# For the list type, update given list of submodules.
|
||||||
if isinstance(submodules, list):
|
if isinstance(submodules, list):
|
||||||
for submodule in submodules:
|
for submodule in submodules:
|
||||||
|
if self.sync_submodules:
|
||||||
|
project.git(['submodule', 'sync', '--recursive',
|
||||||
|
'--', submodule.path])
|
||||||
project.git(['submodule', 'update',
|
project.git(['submodule', 'update',
|
||||||
'--init', submodules_update_strategy,
|
'--init', submodules_update_strategy,
|
||||||
'--recursive', submodule.path])
|
'--recursive', submodule.path])
|
||||||
# For the bool type, update all project submodules
|
# For the bool type, update all project submodules
|
||||||
elif isinstance(submodules, bool):
|
elif isinstance(submodules, bool):
|
||||||
|
if self.sync_submodules:
|
||||||
|
project.git(['submodule', 'sync', '--recursive'])
|
||||||
project.git(['submodule', 'update', '--init',
|
project.git(['submodule', 'update', '--init',
|
||||||
submodules_update_strategy, '--recursive'])
|
submodules_update_strategy, '--recursive'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue