Skip to content

Commit

Permalink
Apply repo partialclonefilter settings to submodules.
Browse files Browse the repository at this point in the history
Filter options applied to a repo during the edkrepo clone command will apply to
submodules when edkrepo updates submodules.

Signed-off-by: Nathaniel Haller <[email protected]>
  • Loading branch information
ndhaller authored and ashedesimone committed Jun 28, 2024
1 parent 8e5a698 commit 314f14f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions project_utils/submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ def _update(repo, submodules=None, verbose=False, recursive=False, cache_path=No
"""
# Now perform the update of the submodules. For a fully recursive submodule init
# this code will update and initialize at the same time.
repo_filter = repo.git.execute(['git', 'config', 'remote.origin.partialclonefilter'])
if repo_filter == "tree:0":
submodule_filter = '--filter=tree:0'
elif repo_filter == "blob:none":
submodule_filter = '--filter=blob:none'
else:
submodule_filter = None

if submodules is None:
cmd = ['git', 'submodule', 'sync']
if recursive:
Expand All @@ -84,6 +92,8 @@ def _update(repo, submodules=None, verbose=False, recursive=False, cache_path=No
cmd.append('--recursive')
if cache_path is not None:
cmd.extend(['--reference', cache_path])
if submodule_filter != None:
cmd.append(submodule_filter)
output_data = repo.git.execute(cmd, with_extended_output=True, with_stdout=True)
ui_functions.display_git_output(output_data, verbose)
else:
Expand All @@ -104,6 +114,8 @@ def _update(repo, submodules=None, verbose=False, recursive=False, cache_path=No
if cache_path is not None:
cmd.extend(['--reference', cache_path])
cmd.extend(['--', sub.path])
if submodule_filter != None:
cmd.append(submodule_filter)
output_data = repo.git.execute(cmd, with_extended_output=True, with_stdout=True)
ui_functions.display_git_output(output_data, verbose)
return
Expand Down

0 comments on commit 314f14f

Please sign in to comment.