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.
This commit is contained in:
William A. Kennington III 2014-01-09 23:11:22 -06:00
parent 153b4ccf71
commit 42229f1040

View file

@ -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;
}