Skip to content

Commit dfa95a3

Browse files
authored
Merge pull request #4339 from PetrKralCZ/20230830164846_new_pr_aPuvVKDsCe
Fix submodule filtering bug in `git_config`
2 parents a5625f4 + 2e94335 commit dfa95a3

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

easybuild/tools/filetools.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,11 +2683,13 @@ def get_source_tarball_from_git(filename, targetdir, git_config):
26832683
# if a specific commit is asked for, check it out
26842684
if commit:
26852685
checkout_cmd = [git_cmd, 'checkout', commit]
2686-
if recursive:
2687-
checkout_cmd.extend(['&&', git_cmd, 'submodule', 'update', '--init', '--recursive'])
2688-
elif recurse_submodules:
2686+
2687+
if recursive or recurse_submodules:
26892688
checkout_cmd.extend(['&&', git_cmd, 'submodule', 'update', '--init'])
2690-
checkout_cmd.extend(["--recurse-submodules='%s'" % pat for pat in recurse_submodules])
2689+
if recursive:
2690+
checkout_cmd.append('--recursive')
2691+
if recurse_submodules:
2692+
checkout_cmd.extend(["--recurse-submodules='%s'" % pat for pat in recurse_submodules])
26912693

26922694
run.run_cmd(' '.join(checkout_cmd), log_all=True, simple=True, regexp=False, path=repo_name)
26932695

test/framework/filetools.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,7 +2857,20 @@ def run_check():
28572857
]) % git_repo
28582858
run_check()
28592859

2860+
git_config['recurse_submodules'] = ['!vcflib', '!sdsl-lite']
2861+
expected = '\n'.join([
2862+
r' running command "git clone --no-checkout %(git_repo)s"',
2863+
r" \(in .*/tmp.*\)",
2864+
' running command "git checkout 8456f86 && git submodule update --init --recursive'
2865+
+ ' --recurse-submodules=\'!vcflib\' --recurse-submodules=\'!sdsl-lite\'"',
2866+
r" \(in testrepository\)",
2867+
r' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"',
2868+
r" \(in .*/tmp.*\)",
2869+
]) % git_repo
2870+
run_check()
2871+
28602872
del git_config['recursive']
2873+
del git_config['recurse_submodules']
28612874
expected = '\n'.join([
28622875
r' running command "git clone --no-checkout %(git_repo)s"',
28632876
r" \(in .*/tmp.*\)",

0 commit comments

Comments
 (0)