summaryrefslogtreecommitdiffstats
path: root/pkgs/build-support/fetchgit/nix-prefetch-git
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2013-11-17 23:54:40 -0600
committerBjørn Forsman <bjorn.forsman@gmail.com>2013-11-24 14:03:34 +0100
commit49b36a3a777295e7d6f872ad0ce48789455e9598 (patch)
tree1aca75c6f13000a44f9f0dd083f23df9f4a86c1c /pkgs/build-support/fetchgit/nix-prefetch-git
parente9963296b15355ad12b89288f6abec26a718e569 (diff)
Fix nix-prefetch-git
The nix-prefect git script was broken when trying to parse certain groups of submodules. This patch fixes the url detection for submodule repositories to use the more reliable `git config` commands.
Diffstat (limited to 'pkgs/build-support/fetchgit/nix-prefetch-git')
-rwxr-xr-xpkgs/build-support/fetchgit/nix-prefetch-git10
1 files changed, 6 insertions, 4 deletions
diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git
index 00cd7d3129b3..0afae009dc57 100755
--- a/pkgs/build-support/fetchgit/nix-prefetch-git
+++ b/pkgs/build-support/fetchgit/nix-prefetch-git
@@ -142,10 +142,12 @@ init_submodules(){
git submodule status |
while read l; do
# checkout each submodule
- local hash=$(echo $l | sed 's,^-\([0-9a-f]*\) \(.*\)$,\1,');
- local dir=$(echo $l | sed 's,^-\([0-9a-f]*\) \(.*\)$,\2,');
- local url=$(sed -n "\,$dir, { :loop; n; s,^.*url = ,,; T loop; p; q }" .git/config);
-
+ local hash=$(echo $l | awk '{print substr($1,2)}');
+ local dir=$(echo $l | awk '{print $2}');
+ local name=$(
+ git config -f .gitmodules --get-regexp submodule\.[^.]*\.path |
+ sed -n "s,^\(.*\)\.path $dir\$,\\1,p")
+ local url=$(git config -f .gitmodules --get ${name}.url);
clone "$dir" "$url" "$hash" "";
done;
}