about summary refs log tree commit diff
path: root/pkgs/build-support/fetchgit
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-01-09 23:11:22 -0600
committerWilliam A. Kennington III <william@wkennington.com>2014-01-10 17:28:35 -0600
commit42229f1040079c959ea47ed4232b008bf1e7b6db (patch)
treeaa1511d6dcce3ede248c52bae830a4e61cf12df1 /pkgs/build-support/fetchgit
parent153b4ccf7148aaaa3761f546d43743775ea143ca (diff)
downloadnixlib-42229f1040079c959ea47ed4232b008bf1e7b6db.tar
nixlib-42229f1040079c959ea47ed4232b008bf1e7b6db.tar.gz
nixlib-42229f1040079c959ea47ed4232b008bf1e7b6db.tar.bz2
nixlib-42229f1040079c959ea47ed4232b008bf1e7b6db.tar.lz
nixlib-42229f1040079c959ea47ed4232b008bf1e7b6db.tar.xz
nixlib-42229f1040079c959ea47ed4232b008bf1e7b6db.tar.zst
nixlib-42229f1040079c959ea47ed4232b008bf1e7b6db.zip
nix-prefetch-git: Convert relative submodule URLS to absolute URLS
nix-prefetch-git does not convert relative submodule urls into absolute
urls based on the parent's origin. This patch adds support for
repositories which are using the relative url syntax.
Diffstat (limited to 'pkgs/build-support/fetchgit')
-rwxr-xr-xpkgs/build-support/fetchgit/nix-prefetch-git6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git
index 0afae009dc57..8d0de055c756 100755
--- a/pkgs/build-support/fetchgit/nix-prefetch-git
+++ b/pkgs/build-support/fetchgit/nix-prefetch-git
@@ -148,6 +148,12 @@ init_submodules(){
             git config -f .gitmodules --get-regexp submodule\.[^.]*\.path |
             sed -n "s,^\(.*\)\.path $dir\$,\\1,p")
         local url=$(git config -f .gitmodules --get ${name}.url);
+
+        # Get Absolute URL if we have a relative URL
+        if ! echo "$url" | grep '^[a-zA-Z]\+://' >/dev/null 2>&1; then
+          url="$(git config --get remote.origin.url)/$url"
+        fi
+
         clone "$dir" "$url" "$hash" "";
     done;
 }