Merge pull request #238733 from domenkozar/fetchgit-submodules-parallel

fetchgit: fetch submodules in parallel
This commit is contained in:
Domen Kožar 2023-06-21 08:55:21 +01:00 committed by GitHub
commit b51a53644c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -206,27 +206,7 @@ checkout_ref(){
# Update submodules
init_submodules(){
# Add urls into .git/config file
clean_git submodule init
# list submodule directories and their hashes
git submodule status |
while read -r l; do
local hash
local dir
local name
local url
# checkout each submodule
hash=$(echo "$l" | awk '{print $1}' | tr -d '-')
dir=$(echo "$l" | sed -n 's/^.[0-9a-f]\+ \(.*[^)]*\)\( (.*)\)\?$/\1/p')
name=$(
git config -f .gitmodules --get-regexp submodule\..*\.path |
sed -n "s,^\(.*\)\.path $dir\$,\\1,p")
url=$(git config --get "${name}.url")
clone "$dir" "$url" "$hash" ""
done
clean_git submodule update --init --recursive -j $NIX_BUILD_CORES
}
clone(){