Skip to content

Commit f32f0d3

Browse files
committed
Clone all submodules without groovy handlers
List and clone all submodules that are still unitialized after all the handlers have run. Signed-off-by: Bence Szépkúti <[email protected]>
1 parent 8fa7d95 commit f32f0d3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

vars/checkout_repo.groovy

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,20 @@ void checkout_repo(BranchInfo info) {
188188
error("Invalid repo: ${info.repo}")
189189
}
190190

191+
echo 'Clone all remaining submodules without dedicated handlers'
192+
sh '''
193+
# Initialize submodule variables (required by `git submodule status`)
194+
git submodule init
195+
git submodule foreach 'git submodule init'
196+
197+
# Only split unquoted expansions on newlines
198+
IFS='
199+
'
200+
for module in $(git submodule status --recursive | sed -n 's/^-[^ ]* //p'); do
201+
git -C "$module" submodule update --recursive --init --depth=1 .
202+
done
203+
'''
204+
191205
stash name: stashName, includes: '**/*', useDefaultExcludes: false
192206
info.stash = stashName
193207
needUnstash = false

0 commit comments

Comments
 (0)