about summary refs log tree commit diff
path: root/pkgs/build-support/fetchgit
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2023-06-20 10:36:10 +0100
committerDomen Kožar <domen@dev.si>2023-06-20 10:36:10 +0100
commit4f72b6af8bb66addaeffc0f59c85bb2813d47ff7 (patch)
tree7ebef0826ba7fd11af9450260e57a549af3ab334 /pkgs/build-support/fetchgit
parentb7b4da16638ecc8c1465a45289c58bff7549faaf (diff)
fetchgit: fetch submodules in parallel
Diffstat (limited to 'pkgs/build-support/fetchgit')
-rwxr-xr-xpkgs/build-support/fetchgit/nix-prefetch-git22
1 files changed, 1 insertions, 21 deletions
diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git
index ba2dfa2fb2c48..e46ccf538bd54 100755
--- a/pkgs/build-support/fetchgit/nix-prefetch-git
+++ b/pkgs/build-support/fetchgit/nix-prefetch-git
@@ -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(){